1,174 Posted Topics
Re: [QUOTE=kleinsun;816674] But this operation always fails. Could anybody give me a little hint? Thanks![/QUOTE] [URL="http://msdn.microsoft.com/en-us/library/ms679360(VS.85).aspx"]GetLastError()[/URL] gives you an error code (defined in winerror.h), which might prove to be useful. | |
Re: [QUOTE=marcosjp;817147] Is it possible to detect the Windows version (or at least detect if it's XP or Vista) from a C++ code?[/QUOTE] Yes it is. See [URL="http://msdn.microsoft.com/en-us/library/ms724429(VS.85).aspx"]Getting the System Version[/URL] | |
Re: To get 'non-destructive writes', open the file specifying also the [ICODE]ios::in[/ICODE] mode. | |
Re: [QUOTE=FTProtocol;667999]Just wondering if theres a function to get the window title of your browser. Like if you were to visit [url]www.myspace.com[/url] your window title would be: [url]www.myspace.com[/url] - Mozilla Firefox or w/e browser you happen to use. Is there a way to get the title of a window?[/QUOTE] Use [ICODE]GetWindowText()[/ICODE] … | |
Re: [QUOTE=amt_muk;753309] [B]..\source\CRaterEDRFile.cpp(276) : error C3861: 'open': identifier not found[/B] [/QUOTE] Microsoft has renamed it to _open(), see [url]http://msdn.microsoft.com/en-us/library/ms235491.aspx[/url] | |
Re: It appears as if you might have stumbled upon the virtualization feature of Windows Vista. Try looking it up on the MSDN. | |
Re: [URL="http://www.cplusplus.com/reference/clibrary/cstdlib/rand.html"]Here[/URL] is a reference for rand() along with a simple example of its usage. | |
Re: To see how the _declspec(dllexport) and _declspec(dllimport) are supposed to be used, try creating a new 'dynamic link library' project in CodeBlocks. When you build the DLL project, remember to define the BUILD_DLL macro (do it via the project's build options). There are a couple of errors, see below [code] … | |
Re: [QUOTE=robgeek;746214] The error says: "initialization skipped by case label."[/QUOTE] You can circumvent that [COLOR="Red"]by[/COLOR] ... [code] int main() { ... switch(option) { case 'h': case 'H': [COLOR="Red"]{[/COLOR] // new scope begins here ... ... ifstream input("Help.txt"); ... [COLOR="Red"]}[/COLOR] // ... and ends here break; ... } return 0; } [/code] | |
Re: There are two images in the icon resource, you either have to modify both of them or simply delete one image. | |
Re: Wouldn't it be easiest to add 'standard' ON_UPDATE_COMMAND_UI handlers for those two sub-menus, i.e. you'd have something along the lines of: [code] ON_UPDATE_COMMAND_UI(IDM_SUBMENU1, OnUpdateSubmenu1) ON_UPDATE_COMMAND_UI(IDM_SUBMENU2, OnUpdateSubmenu2) ... void SomeClass::OnUpdateSubmenu1(CCmdUI* pCmdUI) { pCmdUI->Enable( ... ) } void SomeClass::OnUpdateSubmenu2(CCmdUI* pCmdUI) { pCmdUI->Enable( ... ) } [/code] | |
Re: You are not getting the window text properly, it should be [code=cpp] char editControl_Content[2]; // the following gets one char into editControl_Content[0] and sets // editControl_Content[1] to '\0' int charCount = GetWindowText(GetDlgItem(hwnd, LOWORD(wParam)), editControl_Content, 2); if(charCount > 0) { // got a char ... } [/code] And further on, when … | |
Re: [QUOTE=Xarver;729920]I still need help here. :|[/QUOTE] Assuming that SDL is unable to load the image, you might place a call to [URL="http://sdl.beuc.net/sdl.wiki/SDL_GetError"]SDL_GetError()[/URL] immediately after the line: [ICODE]background = load_image("background.bmp");[/ICODE] to get a description of the cause of the failure. | |
Re: See [URL="http://msdn.microsoft.com/en-us/library/bb762188(VS.85).aspx"]SHGetKnownFolderPath[/URL] | |
Re: [QUOTE=andyT;724057] [code] double *lvec; lvec = new double[COLOR="Red"]([/COLOR]numrows[COLOR="red"])[/COLOR]; [/code][/QUOTE] [COLOR="Red"]That[/COLOR] allocates you a single double, initialized with the value of [ICODE]numrows[/ICODE]. In that case, you delete that double by: [ICODE]delete lvec;[/ICODE] Anyhow, you need to do ... [code] // try allocating numrows doubles ... double *lvec = new double [numrows]; … | |
Re: You'll probably find [URL="http://msdn.microsoft.com/en-us/library/ms685035(VS.85).aspx"]Reading Input Buffer Events[/URL] useful. | |
Re: About code tags ... you don't have to type in the line numbers in the code you post, just specify [ICODE]cplusplus[/ICODE] as the syntax i.e. [noparse][code=cplusplus] // code pasted here ... [/code] [/noparse] | |
Re: [QUOTE=something else;722396]any ideas please [/QUOTE] Microsoft has documented the compiler/linker errors/warnings, so you can try looking them up in the MSDN or in the IDE's help, if you have it installed. See [URL="http://msdn.microsoft.com/en-us/library/aa734003(VS.60).aspx"]Compiler Error C2601[/URL] | |
Re: Try with these [COLOR="Red"]changes[/COLOR] [code] //CUSTOMERDLL.H #ifndef DllH #define DllH #include "customerForm.h" [COLOR="Red"]extern [/COLOR]TCustomerF* DllCustomer; //--------------------------------------------------------------------- void __fastcall Search (AnsiString, AnsiString, TIBTable*); extern "C" __declspec(dllexport) __stdcall void CreateCustomer(TComponent *Owner); //--------------------------------------------------------------------- #endif [/code] [code] //--------------------------------------------------------------------------- //CUSTOMERDLL.CPP #include <vcl.h> #include <windows.h> #pragma hdrstop #pragma argsused #include "customerdll.h" [COLOR="Red"]TCustomerF* DllCustomer = NULL;[/COLOR] int … | |
Re: [QUOTE=Liszt;719073] As I have put the filter to "LastWrite" why does the event shoot 2 times because I limit it to just LastWrite and are not using the "LastAccess" also.[/QUOTE] I guess that your editor makes calls to Windows API functions that cause the event to occur twice. You might … | |
Re: I think you are using a 32-bit toolset (VS Express) and trying to link with the 64-bit version of libmysql.lib. The 32-bit version of libmysql.lib comes with those missing symbols, what you have is the 64-bit library. | |
Re: [QUOTE=sladesan;715306]I have made a few changes so I putting the copy of the code in and yes I am still getting the same problem. [/QUOTE] Rather use [ICODE]new[/ICODE] instead of [ICODE]malloc()[/ICODE] for allocating the [ICODE]scout[/ICODE] structures (because [ICODE]scout[/ICODE] contains a [ICODE]std::string[/ICODE] member variable) | |
Re: You most definitely want to take the [ICODE]inData.open("Unknown.txt");[/ICODE] and [ICODE]inData.close();[/ICODE] out of the for() loop. Open the file before you enter the loop and close the file after the loop has finished. | |
Re: [QUOTE=kenji;713576]Tried what you said but getting the same result. :-/[/QUOTE] Perhaps your intention was to replace also a '\v' with a space but you forgot to do it? | |
Re: The following should work ... [code] LRESULT CALLBACK WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) { switch (uMsg) { case WM_CREATE: // ... create the richedit window here -> hWndRichEdit // set event mask ... SendMessage(hWndRichEdit, EM_SETEVENTMASK, (WPARAM)0 (LPARAM)ENM_MOUSEEVENTS); break; case WM_NOTIFY: { const MSGFILTER * pF = (MSGFILTER … | |
Re: [QUOTE=niek_e;699618]Or if you want to type in even less characters: [code=c] printf("*\n***\n******\n*******\n*********\n"); [/code] I typed 8 characters less (double quotes) and saved myself up to 3 seconds of time :)[/QUOTE] Hmm .. or even less [code=c] puts("*\n***\n******\n*******\n*********"); [/code] | |
Re: I think you are after ... [code] typedef List<String^> Vec1; typedef List<Vec1^> Vec2; Vec2 List1; for( int j = 0; j < 1000; j++ ) { List1.Add(gcnew Vec1()); for( int i = 0; i < 1000; i++ ) { List1[j]->Add("0"); } } [/code] | |
Re: [QUOTE=gangsta1903;702798]ok,I put those checkings but there still seems no problem,but no output too... I tried char* instead of strings but it still didnt work...[/QUOTE] One fix to the reading problem is to re-open the file, or alternatively you might implement something similar to [URL="http://www.cplusplus.com/reference/iostream/istream/seekg.html"]seekg()[/URL] to set position of the [I]get … | |
Re: [QUOTE=unk45;702862]ok makes sense..but why is it temp[0]...in other words shouldnt it be the last index and as of my understanding with index 0 isnt it looking at element 0??[/QUOTE] [ICODE]temp[0][/ICODE] is actually in the ivailosp's program, however you must use what niek_e told, which is: [ICODE]temp[count] = '\0';[/ICODE]. | |
Re: You should initialize [ICODE]ElementAmount[/ICODE] to zero. Note that if you compile with the [ICODE]-pedantic[/ICODE] option, you'll get an error about variable-size array usage, i.e. you might want to change ... [code] char binary[ElementAmount]; [/code] to [code] char * binary = new char[ElementAmount]; [/code] | |
Re: Change `s.erase(pos, pos);` to `s.erase(pos, 1);`. The second parameter tells how many characters to remove at index `pos`. [EDIT] Seems I was late ... | |
Re: You might try something like ... [code] #include <iostream> using namespace std; struct test { void myfunction() { cout << "myfunction()\n"; } test() { myfunction(); } }; static test testing; int myfunction2() { cout << "myfunction2\n" << endl; return 43; } static int test2 = myfunction2(); int main(void) { cout … | |
Re: [QUOTE=gin1026;699928] regarding the question again, i will now continue to find the solution, so, instead of using namespace, can anyone give me some clue how to implement the clocking code in .c files? thanks1[/QUOTE] Use [ICODE]#include <time.h>[/ICODE], and use [ICODE]clock_t[/ICODE] and [ICODE]clock()[/ICODE] instead of [ICODE]std::clock_t[/ICODE] and [ICODE]std::clock()[/ICODE]. | |
Re: Results of double_to_string() is somewhat off due to a missing zero ... [QUOTE] void double_to_string() { std::clock_t start = std::clock() ; for(int i = 0; i < 200000[COLOR="Red"]0[/COLOR]; i++) { [/QUOTE] | |
Re: [QUOTE=chanda gul;698144] DWORD dwFilePointer = SetFilePointer(h,0,0, FILE_BEGIN); [/QUOTE] That gives you the [URL="http://en.wikipedia.org/wiki/Master_boot_record"]master boot record[/URL] (MBR). Based on the [URL="http://www.ntfs.com/partition-table.htm"]partition table[/URL]s within the MBR, you can locate the boot sector that you are looking for (i.e. figure out the number of sectors you have to bypass before landing on the … | |
Re: [QUOTE=Athos84;689025]mouse function is not defined into two files.. what can I do?[/QUOTE] That error occurs also if you have implemented the mouse() function in a header file (.h) and include that header file in two or more source files (.cpp). So, you should move the [I]implementation[/I] of the mouse() function … | |
Re: [QUOTE=Sky Diploma;695494] [CODE] vector<string>numbers; string temp; [COLOR="Red"]while(!infile.eof())[/COLOR]{ infile>>temp; numbers.push_back(temp); } [/code][/QUOTE] [URL="http://www.daniweb.com/forums/post155265-18.html"]Avoid Loop Control Using eof()[/URL] | |
Re: [QUOTE=jrrr;695951]compiler says that in this code..."name lookup change ISO 'for' scoping then using obsolete binding at i"... [/QUOTE] It means that the [ICODE]i[/ICODE] exists only within the for() loop. You might change it to ... [code] int i; for (i=0; i<20; i++) { r [i]=0; } // ... [/code] [EDIT] … | |
Re: See [URL="http://msdn.microsoft.com/en-us/library/aa911430.aspx"]AddFontResource[/URL] | |
Re: [QUOTE=chiwawa10;672942]Thank you for the info, Edward. Here's more information. The application calls a function in a DLL (which was written by me). When the debug's DLL is used, the application does not crash when exit (running on Vista). However, it crashes upon exit when the release's DLL is used instead … | |
Re: [QUOTE=kazek;690852]I'm trying to create a function that will delete an already saved file. I was hoping std::remove() would do the trick but I don't know the syntax. [/QUOTE] [URL="http://www.cplusplus.com/reference/clibrary/cstdio/remove.html"]remove()[/URL] | |
Re: You are not converting from a char to int in the valid() function when comparing with 'a'. Then a couple of notes: - try choosing meaningful names, e.g. the valid() function takes three arguments named: a, b, c. That's a poor practice. - when you ask why a program fails … | |
Re: [QUOTE=Ancient Dragon;687792]I used dumpbin.exe to get a list of all the symbols in libmysql.lib and noted that the function names did not have _ in front of them[/QUOTE] Sounds strange, I dumped the libmysql.lib exports [code] dumpbin /exports libmysql.lib => ... _my_realloc _my_strdup _myodbc_remove_escape@8 _mysql_affected_rows@4 _mysql_autocommit@8 _mysql_change_user@16 _mysql_character_set_name@4 ... whereas, … | |
Re: [QUOTE=bhoot_jb;685904]i am a beginner in MFC programming and using MS VC++ 6.0. I am trying to create my own window using AfxRegisterWndClass(). My code is as follows : [CODE]Frame::Frame() { LPCTSTR className; HBRUSH brush; brush = (HBRUSH) ::GetStockObject (BLACK_BRUSH); className = ::AfxRegisterWndClass ([COLOR="Red"]WS_OVERLAPPEDWINDOW[/COLOR], AfxGetApp()->LoadStandardCursor (IDC_CROSS), brush, AfxGetApp()->LoadStandardIcon (IDI_ERROR)); Create (className, … | |
Re: [QUOTE=Mehwish Shaikh;683591] its giving me so many errors....[/QUOTE] Well, first of all, be [I]consistent[/I] with the names of the member functions, for example [code] int BST::[COLOR="Red"]SEARCHtree[/COLOR](node* i, int k) { if(i==NULL) { return 0; } else if(k == i->key) { return(i->key); } else if(k < i->key) { return [COLOR="Red"]TreeSearch[/COLOR](i->left, k); … | |
Re: [QUOTE=Ancient Dragon;684298]flush is a function[/QUOTE] There is also a manipulator by the same name, [URL="http://www.cplusplus.com/reference/iostream/manipulators/flush.html"]flush[/URL] | |
Re: Hmm, just a thought .. how about changing one line of the signature to: cout << "Hi there!" << "I'm a non-standard-compliant C++ coder!"; ;) | |
Re: It appears as if you might find already deleted students, because of the ... [code] for (int n = 0; n < [COLOR="Red"]MAX_STUDENTS[/COLOR]; n++) { if (strcmp(delStudent, students[n].ID) == 0) { [/code] | |
Re: I think you'd want to have the string and the newline the other way around, i.e. [code]text += Dummy2 + System::Environment::NewLine;[/code] | |
Re: Maybe a program that scans any Windows installation and makes it absolutely bug-free. |
The End.