Hmm.. use ID type which quarantees that the values are unique? e.g.
Cohen
Posts
-
DTD and attributes -
Testing tool neededDoes anyone know is there a testing tool available which could do the following: While running the application (which is tested) in debug mode the tool collects coverage information which can be saved for later purposes. And here is the catch, it should be possible to compare two sets of coverage information and perform logical operations to them. This way I could for example find out which lines of code were performed in a given test run but not in another and vice versa. It would be nice if the tool had a visual interface which would highlight the differences in the test run coverages (bit like in WinDiff). This kind of tool would be valuable in a situation where a certain way to perform an operation causes an error but another (alternative) way doesn't. With bigger systems it's quite hard to do this manually. The tool should be usable with VC++ 6.0.
-
Threads and shared basic datatypesIs it quaranteed that operations to basic datatypes are atomic? Or can I safely do the following:
INT g_i; void main() { ... // Manipulate g_i also here... ... } DWORD WINAPI ThreadProc(LPVOID lpParameter) { ... g_i++; // Is this safe? ... }
I started wondering this after noticed functions such asInterlockedIncrement
in MSDN. Where are these functions used? I have always thought that individual increase statement as above are always atomic.. Cohen -
Automate "New Connection Wizard"?Hi Jeff, You can use the RAS API (Remote Access Service) to solve your problem. There's examples how to use it in MSDN. Cohen
-
How to communicate with Parallel PortHi, You can use platform SDKs File Storage operations also for writing and reading data from communication resources (such as parallel and serial ports). Check out
CreateFile()
,WriteFile()
andReadFile()
from MSDN. Cohen -
Schema problem..Hmm, Would this work? Don't have time to test it :) Cohen
-
List Control Header resizing problemHi there, Are these usefull? http://www.codeguru.com/Cpp/controls/listview/columns/article.php/c1065/[^] http://www.codeguru.com/Cpp/controls/listview/columns/article.php/c1061/[^] Cohen
-
how to access form controls in another viewThe CChecklist object you create in the CFruits::OnOK() isn't the same you have subclassed somewhere else in your code. That object isn't subclassed at all and I suppose that this is why you get that runtime error. You could try to do something like this (ain't that pretty though and I'm not sure does this work):
void CFruits::OnOK() { // Obtain handle to checklists parent here HWND hCheckMark = ::GetDlgItem( ::GetDlgItem(handle_to_checklists_parent, IDC_CHECKLIST), IDC_CHECKMARK ); ::ShowWindow( hCheckMark, SW_SHOW ); PostMessage(WM_COMMAND,ID_FILE_CLOSE); }
Cohen
-
C++ Random QuestionGraham - Slow Rick - Slower Cohen - Slowest :-D
-
C++ Random Questionrand()
returns pseudo random numbers rather than real random numbers. This is why you always get the same value. You can work your way around this by setting the random seed, before you invoke rand(). Seed is a number which is used inside the rand() function to produce the sequence of these pseudo random numbers. So, different seed value gives you different sequence of numbers. Common trick is to give the current time as seed number as this gives you a different sequence each time you run your application. You can set the seed like this:srand(static_cast<unsigned>(time(0)));
Make this function call before you use rand() for the first time. If you wan't the numbers be in a spesified range (between 1 and 100) you must use the following line instead of just invoking rand().random = 1 + (rand() % 100);
rand() returns numbers between 0 (?) and RAND_MAX (== big number, depends on you compiler I think) and the above line takes a modulus from the returned value and this conveniently scales the result between 0 and 99. Hope this helps, Cohen -
Debugging a DLLAssuming that I understood you correctly, I think that you should do it the otherway around. Set the executable in project A to the one you compile in project B. This way you can debug your DLL.
-
Implementation of HTML Help in MFC - Help please!!Lakshmi Priya Musuvathy wrote: error C2065: 'HID_MAINFRAME' : undeclared identifier I'd quess that you simply don't include the header file correctly or that you have a typo somewhere. Should it be IDH_MAINFRAME for example?
-
Implementation of HTML Help in MFC - Help please!!Hi, I don't know is it possible to fetch the context IDs programmatically from the CHM-file. I have always used hardcoded values (and the people who have made the help-files have ofcourse used those same values). So, make a header file. e.g. HelpIDs.h where you define the IDs:
#define HID_MAINVIEW 100 #define HID_SOMEOTHERVIEW 101 #define HID_YETANOTHERVIEW 102
Then include this file and just invoke html help with the correct idHtmlHelp( GetDesktopWindow(), "helpfile.chm", HH_HELP_CONTEXT, HID_MAINVIEW) ;
I have no experience from making the chm-files though..