Hi, thank you very much. Do you mean the following? (1)in APP.cpp CDialog dialog int t1 = dialog.parameter1 (2)in View.cpp T1 = AfxgetApp()->t1 :)
pkyiu
Posts
-
How to spawn CDialog by CWinThread? -
How to spawn CDialog by CWinThread?Hi Arman, Thank you for your reply. The application is a MDI and the dialog is called by a function of the CView class. After the dialog passes the parameters to this function, it runs a loop which preforms a calculation and display results on the childframe window. I tried to use InvalidateRect(NULL,NULL,true) inside the function before the loop but all the icons on the toolbar disappears and only reappears after the loop completes. If use InvalidateRect(m_hWnd,NULL,true) then the dialog only vanish if I clicked "OK" while the dialog is upon the childframe window. If the dialog is partially away from the childframe window, then it remains appear despite I clicked "OK". I was told that creating a separate processing thread for the dialog will solve the problem but I have little idea on multi threading with MFC. Hope you understand and thank you very much! :)
-
How to spawn CDialog by CWinThread?Hi gentlemen, I am newbie to MFC programming and I have a problem creating a dialog on a separate thread from the main application. My situation is: by clicking an icon on a toolbar, a dialog will be prompted and asking for input. As entered the numbers and clicked "OK", these parameters will be passed to the main application to run in a loop and the result will be displayed. Without threading, the displayed result is obstructed by the dialog and applying the InValidateRect function is not satisfactory since the toolbar now becomes invisible. Now I have create a "CSub" class based on CDialog and a "CDialogThread" class based on CWndThread. My question is, how to instruct the dialog to run on the thread, then how to pass the threaded dialog parameter back to the main application? Thank you very much! :)
-
Question about Harddrive writesHello, Are you saying 3MB x 100 times/second = 300MegaByte/sec? If this is the case, you need some special hard drives, i.e. SAS or SCSI 15K rpm, in RAID 0 with 4 or 6 such drives. Then it may be possible to capture data without lose. Conventional single 7.2K rpm desktop drives only can maintain ~50MegaByte/sec and you need to pay attention on that. Hope it helps. :)
-
Hex addition and Hex-to-ASCII string conversion with VC++Hi, Thanks for the reply, here is what I finally wrote since 5A and 30 are kept constant. unsigned long int z; char buf[6]; z = 0x303530; // 5A-303530-30 do { buf[0] = 0x5A; buf[1] = (z & 0xff0000) >> 16; buf[2] = (z & 0xff00) >> 8; buf[3] = (z & 0xff); buf[4] = 0x30; buf[5] = 0x00; printf("%s\n", buf); serial.Write(buf); z = z + 1; if ((z & 0xff) > 0x3f) { z = (z + 0x100) & 0xffff00; z = z + 0x30; if ((z & 0xff00) > 0x3f00) { z = (z + 0x10000) & 0xff00ff; z = z + 0x3000; if ((z & 0xff0000) > 0x3f0000) { z = (z + 0x1000000) & 0x00ffff; z = z + 0x300000; } } } Sleep(150); } while (z <= 0x353130); // 5A-353130-30 It's HEX addaition of 1 and output to RS232 by cserial, thanks anyway.;)
-
Hex addition and Hex-to-ASCII string conversion with VC++Hello everybody, I am a newbie to C++ programming and I need to do some hex addition with VC++ and then output the result as ASCII. Here is my problem: hex1(5A 30 35 30 30) which is equal to decimal(387355848752), I want to add hex(100) to hex1, result is hex2(5A 30 35 31 30) equal to decimal(387355849008). This is exactly equal to adding 256 to the first decimal. I know unsigned int data type can only support 4294967295 which is still not enough for my case, and I would like to know how to convert these hex to ASCII with VC++? (Help received! Thx) Besides, I need to convert the output to ASCII string format, which is "Z0500" and "Z0510" respectively, how can I do that? Your help is very much appreciated, thank you!:) Here is the code with help from forum member, but my second question is not yet solve: #include #include #include #include #include #include int main() { long long h; long long h1 = 0x5A30353030LL; long long h2 = 0x5A303F3F30LL; long long h3 = 0x100LL; CString Str; unsigned char Write_Buff[1]; for (h=h1; h<=h2; h+=h3) { _tprintf_s(_T("%I64X\n"), h); Write_Buff[0] = h; Str.Format("0x0%x",Write_Buff[0]); Sleep(10); } _getch(); }
-
Hex addition with VC++ in WinXPThank you very much! It works fine and I was in such hurry and I overlooked (Managed), and I should have posted on the VC++/MFC board? Sorry for my mistake.:) Besides, how can I convert the resulting hex to ASCII string? Is there a function _tprintf_s(_T("%s\n"), h1+h2); ? I tried but it does not work.:confused: -- modified at 13:35 Saturday 2nd December, 2006
-
Hex addition with VC++ in WinXPHello everybody, I am a newbie to C++ programming and I need to do some hex addition with VC++ and then output the result as ASCII. Here is my problem: hex1(5A 30 35 30 30) which is equal to decimal(387355848752), I want to add hex(100) to hex1 which is hex2(5A 30 35 31 30) equal to decimal(387355849008). This is exactly equal to adding 256 to the first decimal. I know unsigned int data type can only support 4294967295 which is still not enough for my case, and I would like to know how to convert these hex to ASCII with C++? Your help is very much appreciated, thank you.:)
-
How to test the MTTTY example of serial comm in Win32 console?Hello all, I am new to Windows programming and VStudio.Net. I am just trying to assess COM1 by writing a simple win32 console project using VS.Net. I built an empty console project and add the files from the MSDN MTTTY example. http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnfiles/html/msdn\_serial.asp but I have the following error while compiling: Linking... Init.obj : error LNK2019: unresolved external symbol __imp__InitCommonControls@0 referenced in function _GlobalInitialize Transfer.obj : error LNK2019: unresolved external symbol __imp__timeSetEvent@20 referenced in function _TransferRepeatCreate Transfer.obj : error LNK2019: unresolved external symbol __imp__timeKillEvent@4 referenced in function _TransferRepeatDestroy LIBCD.lib(crt0.obj) : error LNK2019: unresolved external symbol _main referenced in function _mainCRTStartup Debug/Serial_win32.exe : fatal error LNK1120: 4 unresolved externals Did I miss anything here? How can I get these 4 error fixed? Besides, I just want to assess the COM ports using DOS style programs and not GUIs, should I must learn win32 API programming? Thanks very much!