Displays a modal dialog box that contains a system icon, a set of buttons, and a brief application-specific message, such as status or error information. The message box returns an integer value that indicates which button the user clicked.
#include<windows.h> int main() { MessageBox(0,"Hello","Welcome Message",1); return 0; }
A string is a data set in the form of alphanumeric characters and symbols. For example, if you wanted to use a string to concatenate and display a welcome message displaying a user's name, your code would look something like this: Dim WelcomeMessageString as String = "Welcome to the string demonstration " Dim FormResponseString as String = form1.text Message(WelcomeMessageString + FormResponseString)
Example: MsgBox("This is an example!", MsgBoxStyle.Information, "Example") or: MsgBox("This is an example!", MsgBoxStyle.Exclamation, "Example") or: MsgBox("This is an example!", MsgBoxStyle.Critical, "Example") you can choose between one of these three styles. just add one of these in the line where you want it to be displayed like: Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click MsgBox("This is an example!", MsgBoxStyle.Information, "Example") End Sub
The following code is based upon Microsoft KB216686: How to automate Excel from C++ without using MFC or #import. The code creates some random data as a table, writing it to a text file in CSV format. This data is then read from the file, printed to std::cout (for verification) before being output to an excel worksheet. #include<iostream> #include<fstream> #include<sstream> #include<array> #include<random> #include<ctime> #include<ole2.h> template<const size_t R, const size_t C> class table_t { std::array<std::array<double, C>, R> data = {}; public: table_t () {} table_t (const table_t& rhs): data {rhs.data} {} table_t (table_t&& rhs): data (std::move (rhs.data)) {} table_t& operator= (const table_t& rhs) { data = rhs.data; } table_t& operator= (table_t&& rhs) { data = std::move (rhs.data); } std::array<double,C>& operator [] (const size_t row) { return data[row]; } const std::array<double,C>& operator [] (const size_t row) const { return data[row]; } size_t rows () const { return R; } size_t columns () const { return C; } std::wstring get_excel_range() const { std::wstringstream ss; ss << L"A1:"; size_t cols=C; while (cols) { ss << static_cast<char>((cols-1)%26+L'A'); cols /= 26; } ss << R; return ss.str(); } }; template<const size_t R, const size_t C> std::ostream& operator<< (std::ostream& os, const table_t<R,C>& table) { for (size_t row=0; row<R; ++row) { for (size_t col=0; col<C; ++col) { os << table[row][col]; if (col<C-1) os << ", "; } os << std::endl; } return os; } // forward declarations... void create_data (const std::string&, const size_t, const size_t); template<const size_t R, const size_t C> table_t<R,C> read_data (const std::string&); template<const size_t R, const size_t C> int write_to_excel (const table_t<R,C>&); HRESULT AutoWrap (int, VARIANT*, IDispatch*, LPOLESTR, int ...); int main() { const size_t rows=10; const size_t cols=5; const std::string textfile {"sample.txt"}; // create sample data... create_data (textfile, rows, cols); // read and print the sample data... table_t<rows, cols> table = read_data<rows, cols> (textfile); std::cout << "Sample data:\n\n"; std::cout << table << std::endl; // output data to excel... return write_to_excel (table); } // Function to create a sample CSV data file with random data. void create_data (const std::string& filename, const size_t rows, const size_t cols) { std::default_random_engine generator ((unsigned) time (0)); std::uniform_int_distribution<unsigned> distribution (0, 10000); std::ofstream os (filename); if (!os.bad()) { for (size_t row=0; row<rows; ++row) { for (size_t col=0; col<cols; ++col) { double d = distribution (generator); d /= 100; os << d; if (col!=cols-1) os << ", "; } os << '\n'; } } os.close(); } // Function to read a CSV file and return a table of doubles template<const size_t R, const size_t C> table_t<R,C> read_data (const std::string& filename) { table_t<R,C> table; size_t row=0; std::ifstream is (filename); std::string line; while (std::getline (is, line)) { size_t col=0; std::stringstream ss1; ss1 << line; std::string value; while (std::getline (ss1, value, ',')) { std::stringstream ss2; ss2 << value; double d; ss2 >> d; table[row][col] = d; ++col; } ++row; } is.close(); return table; } template<const size_t R, const size_t C> int write_to_excel (const table_t<R,C>& table) { // Initialize COM for this thread... CoInitialize (nullptr); // Get CLSID for our server... CLSID clsid; HRESULT hr = CLSIDFromProgID(L"Excel.Application", &clsid); if (FAILED(hr)) { ::MessageBox (nullptr, "CLSIDFromProgID() failed", "Error", 0x10010); return -1; } // Start server and get IDispatch... IDispatch *pXlApp; hr = CoCreateInstance (clsid, nullptr, CLSCTX_LOCAL_SERVER, IID_IDispatch, (void **)&pXlApp); if(FAILED(hr)) { ::MessageBox (nullptr, "Excel not registered properly", "Error", 0x10010); return -2; } // Make it visible (i.e. app.visible = 1) { VARIANT x; x.vt = VT_I4; x.lVal = 1; AutoWrap (DISPATCH_PROPERTYPUT, NULL, pXlApp, L"Visible", 1, x); } // Get Workbooks collection IDispatch *pXlBooks; { VARIANT result; VariantInit(&result); AutoWrap (DISPATCH_PROPERTYGET, &result, pXlApp, L"Workbooks", 0); pXlBooks = result.pdispVal; } // Call Workbooks.Add() to get a new workbook... IDispatch *pXlBook; { VARIANT result; VariantInit(&result); AutoWrap (DISPATCH_PROPERTYGET, &result, pXlBooks, L"Add", 0); pXlBook = result.pdispVal; } // Create a safearray of variants... VARIANT arr; arr.vt = VT_ARRAY | VT_VARIANT; { SAFEARRAYBOUND sab[2]; sab[0].lLbound = 1; sab[0].cElements = table.rows(); sab[1].lLbound = 1; sab[1].cElements = table.columns(); arr.parray = SafeArrayCreate(VT_VARIANT, 2, sab); } // Fill safearray with values from the table... for (size_t row=0; row<table.rows(); ++row) { for (size_t col=0; col<table.columns(); ++col) { // Create value VARIANT tmp; tmp.vt = VT_R8; tmp.dblVal = table[row][col]; // Add to safearray... long indices[] = {row+1,col+1}; SafeArrayPutElement (arr.parray, indices, (void *)&tmp); } } // Get ActiveSheet object IDispatch *pXlSheet; { VARIANT result; VariantInit(&result); AutoWrap (DISPATCH_PROPERTYGET, &result, pXlApp, L"ActiveSheet", 0); pXlSheet = result.pdispVal; } // Get Range object... IDispatch *pXlRange; { VARIANT parm; parm.vt = VT_BSTR; parm.bstrVal = ::SysAllocString (table.get_excel_range().c_str()); VARIANT result; VariantInit (&result); AutoWrap (DISPATCH_PROPERTYGET, &result, pXlSheet, L"Range", 1, parm); VariantClear (&parm); pXlRange = result.pdispVal; } // Set range with our safearray... AutoWrap (DISPATCH_PROPERTYPUT, nullptr, pXlRange, L"Value", 1, arr); // Wait for user... ::MessageBox (nullptr, "All done.", "Notice", 0x10000); // Set .Saved property of workbook to TRUE so we aren't prompted // to save when we tell Excel to quit... { VARIANT x; x.vt = VT_I4; x.lVal = 1; AutoWrap (DISPATCH_PROPERTYPUT, nullptr, pXlBook, L"Saved", 1, x); } // Tell Excel to quit (i.e. App.Quit) AutoWrap (DISPATCH_METHOD, nullptr, pXlApp, L"Quit", 0); // Release references... pXlRange->Release(); pXlSheet->Release(); pXlBook->Release(); pXlBooks->Release(); pXlApp->Release(); VariantClear(&arr); // Uninitialize COM for this thread... CoUninitialize(); return 0; } // AutoWrap() - Automation helper function... HRESULT AutoWrap (int autoType, VARIANT *pvResult, IDispatch *pDisp, LPOLESTR ptName, int cArgs...) { // Begin variable-argument list... va_list marker; va_start (marker, cArgs); if (!pDisp) { MessageBox (nullptr, "NULL IDispatch passed to AutoWrap()", "Error", 0x10010); _exit (0); } // Variables used... DISPPARAMS dp = {nullptr, nullptr, 0, 0}; DISPID dispidNamed = DISPID_PROPERTYPUT; DISPID dispID; HRESULT hr; char buf[200]; char szName[200]; // Convert down to ANSI WideCharToMultiByte (CP_ACP, 0, ptName, -1, szName, 256, nullptr, nullptr); // Get DISPID for name passed... hr = pDisp->GetIDsOfNames (IID_NULL, &ptName, 1, LOCALE_USER_DEFAULT, &dispID); if (FAILED (hr)) { sprintf (buf, "IDispatch::GetIDsOfNames("%s") failed w/err 0x%08lx", szName, hr); MessageBox (nullptr, buf, "AutoWrap()", 0x10010); _exit (0); return hr; } // Allocate memory for arguments... VARIANT *pArgs = new VARIANT[cArgs+1]; // Extract arguments... for (int i=0; i<cArgs; i++) { pArgs[i] = va_arg (marker, VARIANT); } // Build DISPPARAMS dp.cArgs = cArgs; dp.rgvarg = pArgs; // Handle special-case for property-puts! if (autoType & DISPATCH_PROPERTYPUT) { dp.cNamedArgs = 1; dp.rgdispidNamedArgs = &dispidNamed; } // Make the call! hr = pDisp->Invoke (dispID, IID_NULL, LOCALE_SYSTEM_DEFAULT, autoType, &dp, pvResult, nullptr, nullptr); if (FAILED (hr)) { sprintf (buf, "IDispatch::Invoke("%s"=%08lx) failed w/err 0x%08lx", szName, dispID, hr); MessageBox (nullptr, buf, "AutoWrap()", 0x10010); _exit (0); return hr; } // End variable-argument section... va_end(marker); delete [] pArgs; return hr; }
The following example creates an OracleConnection and sets some of its properties in the connection string. * ** Syntax based on .NET Framework version 1.1 ** #using #using #using using namespace System; using namespace System::Data; using namespace System::Data::OracleClient; __gc class COracleConnection{ public:void CreateOracleConnection( ){ String* myConnString Oracle8i;Integrated Security new OracleConnection( myConnString ); myConnection->Open( ); MessageBox::Show( String::Format( S"ServerVersion: {0}\nDataSource:{1}", myConnection->ServerVersion, myConnection->DataSource ) ); myConnection->Close(); } }; // This is the entry point for this application #ifdef _UNICODE int wmain( void ) #else int main( void ) #endif { COracleConnection *pCOracleConnection = new COracleConnection(); pCOracleConnection->CreateOracleConnection( ); return 0; } You will use Oracle's API. Its called OCI for Oracle Call Interface -- use Google for details about its usage. You can also use OTL, which is the Oracle Template Library. Its much easier to use than OCI. Additionally, you can use embedded sql and precompile this code into pure C using the Oracle Pro*C/C++ precompiler. Sample code exists in ORACLE_HOME/precomp/demo/proc and ORACLE_HOME/rdbms/demo. As Oracle is the largest database company in the world with the largest market share of enterprise s/w, you can bet there is code all over the internet to do what you want to do. Check the forums at otn.oracle.com, google (or other search engine), or asktom.oracle.com. Answer You can also use library such as OCILIB (wraper for OCI) and Libsqlora. The other solution is use UnixODBC for unix programming environtment. Visit www.alldatabaseprogramming.blogspot.com or www.gtkinaction.blogspot.com for further information.
Unforunately No. Your best bet is to create your own Messagebox dialog using a simple WindowsForm. Then add the buttons and text, ect.. to mimick the messagebox you have in mind.
#include<windows.h> int main() { MessageBox(0,"Hello","Welcome Message",1); return 0; }
MessageBox is a way to show a message when the user does a specific thing. There is two ways to do it, you can use: MsgBox("text", MsgBoxStyle.whatever, "title) or MessageBox.Show("text", "title")
A string is a data set in the form of alphanumeric characters and symbols. For example, if you wanted to use a string to concatenate and display a welcome message displaying a user's name, your code would look something like this: Dim WelcomeMessageString as String = "Welcome to the string demonstration " Dim FormResponseString as String = form1.text Message(WelcomeMessageString + FormResponseString)
Example: MsgBox("This is an example!", MsgBoxStyle.Information, "Example") or: MsgBox("This is an example!", MsgBoxStyle.Exclamation, "Example") or: MsgBox("This is an example!", MsgBoxStyle.Critical, "Example") you can choose between one of these three styles. just add one of these in the line where you want it to be displayed like: Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click MsgBox("This is an example!", MsgBoxStyle.Information, "Example") End Sub
Private Sub Command1_Click() Dim objAdd As New clsAddPublic.display MsgBox(objAdd.display()) End Sub Namespace Tester Public Interface Tester Function GetTime() as Integer End Interface ClassInterface(ClassInterfaceType.None),_ProgId("Tester.Numbers")> Public class Tester Implements Tester Public Tester() Public Function GetTime() As integer Implements Tester.GetTime Dim Time As Integer Time = DateTime.Now If (Time<12) MessageBox("GOOD MORNING") Elseif (Time=12) Msgbox("GOOD AFTERNOON") ElseIf(Time>18) Msgbox("GOOD NIGHT") End If End If End If End Function Bool CNickDlg::OnInitDialog() CDialog::OnInitDialog(); CString strmessage; Tester::Time *com-ptr; CoInitialize(NULL); Tester::NumbersPtr p(Tester::Time); Com-ptr = t; Int t-Time = com_ptr -> GetTime(); SetIcon(m-hicon, TRUE); SetIcon(m-hicon, False); End Namespace
The following code is based upon Microsoft KB216686: How to automate Excel from C++ without using MFC or #import. The code creates some random data as a table, writing it to a text file in CSV format. This data is then read from the file, printed to std::cout (for verification) before being output to an excel worksheet. #include<iostream> #include<fstream> #include<sstream> #include<array> #include<random> #include<ctime> #include<ole2.h> template<const size_t R, const size_t C> class table_t { std::array<std::array<double, C>, R> data = {}; public: table_t () {} table_t (const table_t& rhs): data {rhs.data} {} table_t (table_t&& rhs): data (std::move (rhs.data)) {} table_t& operator= (const table_t& rhs) { data = rhs.data; } table_t& operator= (table_t&& rhs) { data = std::move (rhs.data); } std::array<double,C>& operator [] (const size_t row) { return data[row]; } const std::array<double,C>& operator [] (const size_t row) const { return data[row]; } size_t rows () const { return R; } size_t columns () const { return C; } std::wstring get_excel_range() const { std::wstringstream ss; ss << L"A1:"; size_t cols=C; while (cols) { ss << static_cast<char>((cols-1)%26+L'A'); cols /= 26; } ss << R; return ss.str(); } }; template<const size_t R, const size_t C> std::ostream& operator<< (std::ostream& os, const table_t<R,C>& table) { for (size_t row=0; row<R; ++row) { for (size_t col=0; col<C; ++col) { os << table[row][col]; if (col<C-1) os << ", "; } os << std::endl; } return os; } // forward declarations... void create_data (const std::string&, const size_t, const size_t); template<const size_t R, const size_t C> table_t<R,C> read_data (const std::string&); template<const size_t R, const size_t C> int write_to_excel (const table_t<R,C>&); HRESULT AutoWrap (int, VARIANT*, IDispatch*, LPOLESTR, int ...); int main() { const size_t rows=10; const size_t cols=5; const std::string textfile {"sample.txt"}; // create sample data... create_data (textfile, rows, cols); // read and print the sample data... table_t<rows, cols> table = read_data<rows, cols> (textfile); std::cout << "Sample data:\n\n"; std::cout << table << std::endl; // output data to excel... return write_to_excel (table); } // Function to create a sample CSV data file with random data. void create_data (const std::string& filename, const size_t rows, const size_t cols) { std::default_random_engine generator ((unsigned) time (0)); std::uniform_int_distribution<unsigned> distribution (0, 10000); std::ofstream os (filename); if (!os.bad()) { for (size_t row=0; row<rows; ++row) { for (size_t col=0; col<cols; ++col) { double d = distribution (generator); d /= 100; os << d; if (col!=cols-1) os << ", "; } os << '\n'; } } os.close(); } // Function to read a CSV file and return a table of doubles template<const size_t R, const size_t C> table_t<R,C> read_data (const std::string& filename) { table_t<R,C> table; size_t row=0; std::ifstream is (filename); std::string line; while (std::getline (is, line)) { size_t col=0; std::stringstream ss1; ss1 << line; std::string value; while (std::getline (ss1, value, ',')) { std::stringstream ss2; ss2 << value; double d; ss2 >> d; table[row][col] = d; ++col; } ++row; } is.close(); return table; } template<const size_t R, const size_t C> int write_to_excel (const table_t<R,C>& table) { // Initialize COM for this thread... CoInitialize (nullptr); // Get CLSID for our server... CLSID clsid; HRESULT hr = CLSIDFromProgID(L"Excel.Application", &clsid); if (FAILED(hr)) { ::MessageBox (nullptr, "CLSIDFromProgID() failed", "Error", 0x10010); return -1; } // Start server and get IDispatch... IDispatch *pXlApp; hr = CoCreateInstance (clsid, nullptr, CLSCTX_LOCAL_SERVER, IID_IDispatch, (void **)&pXlApp); if(FAILED(hr)) { ::MessageBox (nullptr, "Excel not registered properly", "Error", 0x10010); return -2; } // Make it visible (i.e. app.visible = 1) { VARIANT x; x.vt = VT_I4; x.lVal = 1; AutoWrap (DISPATCH_PROPERTYPUT, NULL, pXlApp, L"Visible", 1, x); } // Get Workbooks collection IDispatch *pXlBooks; { VARIANT result; VariantInit(&result); AutoWrap (DISPATCH_PROPERTYGET, &result, pXlApp, L"Workbooks", 0); pXlBooks = result.pdispVal; } // Call Workbooks.Add() to get a new workbook... IDispatch *pXlBook; { VARIANT result; VariantInit(&result); AutoWrap (DISPATCH_PROPERTYGET, &result, pXlBooks, L"Add", 0); pXlBook = result.pdispVal; } // Create a safearray of variants... VARIANT arr; arr.vt = VT_ARRAY | VT_VARIANT; { SAFEARRAYBOUND sab[2]; sab[0].lLbound = 1; sab[0].cElements = table.rows(); sab[1].lLbound = 1; sab[1].cElements = table.columns(); arr.parray = SafeArrayCreate(VT_VARIANT, 2, sab); } // Fill safearray with values from the table... for (size_t row=0; row<table.rows(); ++row) { for (size_t col=0; col<table.columns(); ++col) { // Create value VARIANT tmp; tmp.vt = VT_R8; tmp.dblVal = table[row][col]; // Add to safearray... long indices[] = {row+1,col+1}; SafeArrayPutElement (arr.parray, indices, (void *)&tmp); } } // Get ActiveSheet object IDispatch *pXlSheet; { VARIANT result; VariantInit(&result); AutoWrap (DISPATCH_PROPERTYGET, &result, pXlApp, L"ActiveSheet", 0); pXlSheet = result.pdispVal; } // Get Range object... IDispatch *pXlRange; { VARIANT parm; parm.vt = VT_BSTR; parm.bstrVal = ::SysAllocString (table.get_excel_range().c_str()); VARIANT result; VariantInit (&result); AutoWrap (DISPATCH_PROPERTYGET, &result, pXlSheet, L"Range", 1, parm); VariantClear (&parm); pXlRange = result.pdispVal; } // Set range with our safearray... AutoWrap (DISPATCH_PROPERTYPUT, nullptr, pXlRange, L"Value", 1, arr); // Wait for user... ::MessageBox (nullptr, "All done.", "Notice", 0x10000); // Set .Saved property of workbook to TRUE so we aren't prompted // to save when we tell Excel to quit... { VARIANT x; x.vt = VT_I4; x.lVal = 1; AutoWrap (DISPATCH_PROPERTYPUT, nullptr, pXlBook, L"Saved", 1, x); } // Tell Excel to quit (i.e. App.Quit) AutoWrap (DISPATCH_METHOD, nullptr, pXlApp, L"Quit", 0); // Release references... pXlRange->Release(); pXlSheet->Release(); pXlBook->Release(); pXlBooks->Release(); pXlApp->Release(); VariantClear(&arr); // Uninitialize COM for this thread... CoUninitialize(); return 0; } // AutoWrap() - Automation helper function... HRESULT AutoWrap (int autoType, VARIANT *pvResult, IDispatch *pDisp, LPOLESTR ptName, int cArgs...) { // Begin variable-argument list... va_list marker; va_start (marker, cArgs); if (!pDisp) { MessageBox (nullptr, "NULL IDispatch passed to AutoWrap()", "Error", 0x10010); _exit (0); } // Variables used... DISPPARAMS dp = {nullptr, nullptr, 0, 0}; DISPID dispidNamed = DISPID_PROPERTYPUT; DISPID dispID; HRESULT hr; char buf[200]; char szName[200]; // Convert down to ANSI WideCharToMultiByte (CP_ACP, 0, ptName, -1, szName, 256, nullptr, nullptr); // Get DISPID for name passed... hr = pDisp->GetIDsOfNames (IID_NULL, &ptName, 1, LOCALE_USER_DEFAULT, &dispID); if (FAILED (hr)) { sprintf (buf, "IDispatch::GetIDsOfNames("%s") failed w/err 0x%08lx", szName, hr); MessageBox (nullptr, buf, "AutoWrap()", 0x10010); _exit (0); return hr; } // Allocate memory for arguments... VARIANT *pArgs = new VARIANT[cArgs+1]; // Extract arguments... for (int i=0; i<cArgs; i++) { pArgs[i] = va_arg (marker, VARIANT); } // Build DISPPARAMS dp.cArgs = cArgs; dp.rgvarg = pArgs; // Handle special-case for property-puts! if (autoType & DISPATCH_PROPERTYPUT) { dp.cNamedArgs = 1; dp.rgdispidNamedArgs = &dispidNamed; } // Make the call! hr = pDisp->Invoke (dispID, IID_NULL, LOCALE_SYSTEM_DEFAULT, autoType, &dp, pvResult, nullptr, nullptr); if (FAILED (hr)) { sprintf (buf, "IDispatch::Invoke("%s"=%08lx) failed w/err 0x%08lx", szName, dispID, hr); MessageBox (nullptr, buf, "AutoWrap()", 0x10010); _exit (0); return hr; } // End variable-argument section... va_end(marker); delete [] pArgs; return hr; }
A DOS program's output/input is based souly on the DOS proment, while a win api based program is based within its own window. Code is untested! // DOS Prompt Code c/c++ - With output #include <iostream> // Input Output Stream int main() { std::cout << "Hello World"; // Output Command return 0; } // Win Api Code c/c++ just window #include <windows.h> LRESULT CALLBACK WndProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam); int WINAPI WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance,PSTR szCmdLine, int iCmdShow) { static TCHAR szAppName[] = TEXT ("Opengl"); HWND hwnd; WNDCLASS wndclass; HDC hdc; MSG msg; HGLRC hrc; wndclass.style = CS_HREDRAW | CS_VREDRAW; wndclass.lpfnWndProc = WndProc; wndclass.cbClsExtra = 0; wndclass.cbWndExtra = 0; wndclass.hInstance = hInstance; wndclass.hIcon = LoadIcon (NULL, IDI_APPLICATION); wndclass.hCursor = LoadCursor (NULL, IDC_ARROW); wndclass.hbrBackground = (HBRUSH) GetStockObject (WHITE_BRUSH); wndclass.lpszMenuName = NULL; wndclass.lpszClassName = szAppName; if (!RegisterClass (&wndclass)) { MessageBox (NULL, TEXT ("This program requires Windows NT!"), szAppName, MB_ICONERROR); return 0; } hwnd = CreateWindow (szAppName, TEXT ("OpengGL"), WS_OVERLAPPEDWINDOW, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, NULL, NULL, hInstance, NULL); ShowWindow (hwnd, iCmdShow); UpdateWindow (hwnd); while (GetMessage (&msg, NULL, 0, 0)) { TranslateMessage (&msg); DispatchMessage (&msg); } return msg.wParam; } LRESULT CALLBACK WndProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) { switch (message) { case WM_PAINT: opengl.callDisplayFunc(); return 0; case WM_SIZE: return 0; case WM_KEYDOWN: switch(wParam) { case VK_ESCAPE: SendMessage(hwnd,WM_DESTROY,wParam,lParam); break; } return 0; case WM_DESTROY: PostQuitMessage(0); return 0; } return DefWindowProc (hwnd, message, wParam, lParam); }
Steps to Create Your First DLLCreate a Win32 Dynamic Link Library project, adding a *.cpp and a *.h file.In the *.cpp file, create a class instantiated from the CWinApp file. Collapse | Copy Code # include # include "SourceFile.h" class CDllApp : public CWinApp { public: CDllApp::CDllApp() { Calc(0,0); } DECLARE_MESSAGE_MAP() }; BEGIN_MESSAGE_MAP(CDllApp,CWinApp) END_MESSAGE_MAP() CDllApp DllObject;In the *.h file (here it is SourceFile.h), define the functions to be used. Also specify the dllexport value for the _declspec function. Collapse | Copy Code extern "C" _declspec(dllexport) int Calc(char no1,char no2) { char result; result = no1 + no2; return result; }Then compile the DLL.Create a normal Win32 Application with a *.cppfile and a *.h file.In the *.h file, (here it is AppHeader.h ), declare the function with the dllimport value of _declspec. Collapse | Copy Code extern "C" _declspec(dllimport) Calc(int FirstValue, int SecondValue);In the *.cpp file, use the function. Collapse | Copy Code # include "AFXWIN.H" # include "AppHeader.h" class MainFrame : public CFrameWnd { public: MainFrame() { Create(0,"Trial"); } void OnLButtonDown(UINT nFlags,CPoint point) { int res; char str[5]; res = Calc(998,226); sprintf(str,"%d",res); MessageBox(str); } DECLARE_MESSAGE_MAP() };In the Link tab of the "Project->Settings" dialog, go to the text box labeled "Object / Library Modules" and specify the path of the DLL file. Then copy the compiled DLL file to your current appliation path directory and run the program.
The following example creates an OracleConnection and sets some of its properties in the connection string. * ** Syntax based on .NET Framework version 1.1 ** #using #using #using using namespace System; using namespace System::Data; using namespace System::Data::OracleClient; __gc class COracleConnection{ public:void CreateOracleConnection( ){ String* myConnString Oracle8i;Integrated Security new OracleConnection( myConnString ); myConnection->Open( ); MessageBox::Show( String::Format( S"ServerVersion: {0}\nDataSource:{1}", myConnection->ServerVersion, myConnection->DataSource ) ); myConnection->Close(); } }; // This is the entry point for this application #ifdef _UNICODE int wmain( void ) #else int main( void ) #endif { COracleConnection *pCOracleConnection = new COracleConnection(); pCOracleConnection->CreateOracleConnection( ); return 0; } You will use Oracle's API. Its called OCI for Oracle Call Interface -- use Google for details about its usage. You can also use OTL, which is the Oracle Template Library. Its much easier to use than OCI. Additionally, you can use embedded sql and precompile this code into pure C using the Oracle Pro*C/C++ precompiler. Sample code exists in ORACLE_HOME/precomp/demo/proc and ORACLE_HOME/rdbms/demo. As Oracle is the largest database company in the world with the largest market share of enterprise s/w, you can bet there is code all over the internet to do what you want to do. Check the forums at otn.oracle.com, google (or other search engine), or asktom.oracle.com. Answer You can also use library such as OCILIB (wraper for OCI) and Libsqlora. The other solution is use UnixODBC for unix programming environtment. Visit www.alldatabaseprogramming.blogspot.com or www.gtkinaction.blogspot.com for further information.
DIM stands for declaration in memory. the words DIM is used to declare a variable. Yes Correct, I used to declare variable. I think it means Dimension, Dimension Of the memory location The original Basic language did not require or have a type definition. All variables were numeric with no distinction between integer and real/float. Assigning space for a variable was easy, they were all the same type and size. Some Basic implementations, using variable name modification, later added character variables by a dollar sign appended (varname$) and an integer type with a percent sign (varname%) leaving the unsuffixed version as it originally was. You were allowed to have all three versions of a name in play at the same time so Basic still had no type declarations. For an array, you needed to tell Basic how much space to allocate for the array. Some of the more used languages at that time (e.g. fortran) used a"Dimension" keyword for this and Basic similarly used a shorter DIM statement. Being that the designers of VB were implementing a version of Basic and they did need a type declaration, I would guess they decided to use the closest thing available: A DIM statement.
1) Change the interface for users asking a questions so that the likelihood of them creating a bad redirect is vastly reduced. To do this, there are many parts:A) Make the function that gives same-as suggestions better so that its suggestions are actually relevant. There are numerous shortcomings and/or bugs that prevent it from finding questions which are totally obvious (ie share multiple keys words in common). This is clearly very technically challenging and may take time. However, keep reading because parts (B) through (F) can still be implemented in the meantime while this is being developed.B) After submitting the question, suggestions should be given. However if should be made much clearer at this stage that users do not have to pick one of these option. A bold-face sentence like "Before submitting your question, make sure that it is not one of these already posted questions. If it does not match EXACTLY, please submit your question here." I also like Schnaz's suggestion in the Super Forum that the "Answer" bar in the header should be replaced with a "Search" bar, which will also reduce the number of questions and alternate wordings and bad redirects which are created and which are never deleted.C) Finally, if users to pick a question as being the same as theirs, there should be a confirmation step -- perhaps after the answer page is displayed -- where the user is asked "Is this the same question as the one you asked? Note that in the future all users who ask your question will be directed to this page."D) And on the Super's side, there should be a direct link from my Watchlist when somebody says a question is the same as another that allows you to immediately split (and move?) that question without going through 3 other pages to do that.E) And the hardest and slowest: Search and destroy all bad redirects lurking under every dark corner in this entire site!!!! And the only way to do this in a reasonable way is with a very powerful function developed for this purpose -- and regarding that, I have no idea!F) Create a 3rd tier of alternate wording that are NOT searched by the function that generates same-as suggestions. These are wordings that are just bad, that mix up different concepts and generally cause redirect problems. If wordings are going to be deleted, they should at least be disabled. This would of course be a Super-only power to be used conservatively.2) Change the search function on the "search" page so that it can find parts of words. Having to search twice for a word, once in the singular and once in the plural is simply ridiculous. Obviously exact matches should rank higher, but partial-word matches should be listed higher than the results that only have one of the two (or more) key words entered into the search bar. I don't even both using the search function anymore because of this shortcoming.3) Increase bandwidth so that loading pages takes much less time -- in particular functions such as splitting, moving, and editing question wording are really really really slow. This nothing short of infuriating with computers that run at the speeds they do today. There is just no excuse for a web-based for-profit company to have such a snail-like interface. Answers.com isn't much faster either. If this isn't worth spending some money on, I don't know what is.4) Well you asked for 3, but the rating system is worthless, and would be really nice if it worked well, but these other three are so much more important. But I couldn't resist adding it also.-- JEKI don't know that I can rank the issues, but allow me to ramble: 1) Topics: I did some maintenance on the sports topic and was astounded by how many questions were misplaced. It is understandable for a certain amount to be misplaced but there must have been literally 1 in 3 that were misplaced, if not more. The vast majority of those that were misplaced were due to the asker not drilling down far enough to find the specific topic of their question. Our friends down under and across the pond probably have no idea there is a Rugby topic listed under Miscellaneous Sports. Or a Cricket topic. There were many questions in the Sports topic concerning firearms. But a breakdown of firearms topics are under Collectibles. ?. No one should be allowed to place a question in a 'main topic heading' (ie., Arts and Entertainment, Health, Sports, etc.). These headings should be markers. Click on the marker and you will see the topics listed, which would include a 'Miscellaneous Arts and Entertainment', 'Miscellaneous Health', and so on. I would suggest a different way of presenting topics to the asker for selection. Maybe when the asker clicks on 'Sports' every single topic under the heading will be shown. Sports (Font Color Red).... American Football (Font Color Blue)........College Football (Font Color Green)........Football History (Font Color Green)........Football Memorabilia (Font Color Green)........NFL Teams (Font Color Blue)............Arizona Cardinals (Font Color Green)....................................Washington Redskins (Font Color Green)........Super Bowl (Font Color Green)....Baseball (Font Color Blue)........Baseball History (Font Color Green) And so on. Display all specific topics under a main heading marker in hopes that the asker will choose the most specific topic for the question. This may create a long page but it will help direct the user to a specific topic. And possibly a discussion on revamping the topic system in general. Some topics seem to be 'out of place' to me. This might also be addressed by having a 'topics dictionary' that I wrote about on the Forum. 2) Consolidate Tasks on One Screen: I have posted on the Forum concerning this. 3) User's Guide: This was brought up on the Forum a few days ago. Many users come to the site and are literally flying blind. Maybe directing them to a user's guide would help in getting better worded questions and better selected topics. I appreciate that the site has many, many users under the legal drinking age and how a user's guide would work with them is questionable. But possibly it would get folks more interested in the site and interested in doing things the WikiAnswers way. 4) Inconsistancies: If I edit a link or move a misplaced redirect, I can press the Enter key and it acts as if I have clicked the Update button. If I add a related question, I cannot press the Enter key and have it act as if I clicked the Update button. In this case nothing is saved and the edit box becomes blank. Maybe not that big of a deal but, after typing in data, it is somewhat easier to press the enter key than to take one's hand off the keyboard and go to the mouse. In all cases like this the Enter key should act as a mouse click of the Update button. Also, clicking on a question in the watchlist or recent site changes opens the question in a new tab (MS VISTA), but clicking on a question when browsing (http://wiki.answers.com/Q/FAQ/XXXX%29opens the question in the same tab. If I am merging questions and I click twice on the Update button I get a messagebox telling me only to click once. If I edit topics and click on the Update button twice I get no error message and the question becomes a duplicate as it has two topic records created for each topic checked. I believe this also occurs with splits. 5) This editor is somewhat difficult at times. 6) If I revert a question to version 1, the original clean question as asked, and there are links associated with the answer the links are not reverted along with the answer? I have to remove the links and revert? 7) Many screens do not have a cursor placed in an edit box upon display. I go to move a misplaced redirect, a screen displays with one edit box, and the cursor is nowhere to be found. I have to click with the mouse in the edit box to get a cursor before entering the question to move the redirect to. This occurs on practically every screen that has edit box. No cursor initially, you have to click in the edit box to get the cursor. We work with the system everyday. We know what is needed to get tasks done more efficiently. We could do the analysis required. We already have, it's just not down on paper. Developing a system is 90 percent analysis and 10 percent coding. If analysis is done correctly, coding is a breeze. I don't know of the legalities involved in allowing volunteers to help develop a system but certainly there are some. I would be willing to sign whatever type of nondisclosure or noncompete waiver that is necessary. Thanks for asking Schnaz, if I may be so familiar. NEXT! PS - I am now getting an email everytime the Forum is updated. I don't remember changing anything concerning that so is this something new? Okay, I'll give my listing! 1. Redirects - Need better 'bulk' editing tools to help get them undercontrol. 2. Question rating system - Maybe it needs to be reset every few months. But the questions that are showing up as tops in my categories are the worst in the whole section and should be at the bottom! 3. The 'shadow' categories are just annoying to me. Granted, they help people find things, but when it comes to moving and editing they bother me. Aggie80That [expletive deleted] WYSIWIG editor! Instead of being a generic HTML editor, it needs to produce and display MediaWiki markup!It should only change what the user change, not what it decides to change on its own! The current form makes it impossible to determine what the user changed and what it decided to mess with.There needs to be an option to disable the stupid thing entirely and return to pure, total MediaWiki markup! (This also means reenabling the entire MediaWiki markup set!!!)The Ask vs. Search function, as above.TBD.How about allowing real people to post real questions rather than computer qenerated questions designed for search engine optimization. Has no one ever noticed that after answering a question, there is NEVER a response saying thank you or clarification? It's sad reallyKevin