|
When I go into the debugger the first argument to fprintf *str is apparently null. But, I don't open the file until a button on the GUI is pressed. The file name is based on the time that the button is hit. After opening the file I call SetTimer to fire every second at which time I try to write to the file. So, I wouldn't think that I would be writing to the file until the global variable FileOut2 gets set...
|
|
|
|
|
So what happens first, fopen() or fprintf() ?
A rich person is not the one who has the most, but the one that needs the least.
|
|
|
|
|
I'm developing a VC++ SDI program that needs to have a couple threads running. The main thread starts by pressing a button in the toolbar which is processed in the Document. This thread reads from a data file once a second, this data is stored as variables in the Document, after this data is read and stored I need to update the View, however I have not been successful at having the View update with out crashing the program.
I have the program setup as a SDI and have added a CWinThread Class. I have been successfull at reading the data with the class but just not updating the View.
Any help with this problem would be great.
J Guds
Masters Student
Kansas University
|
|
|
|
|
The UI is "owned" by the primary thread and should only be updated by it. All other threads should post (not send) a message to the primary thread indicating an update needs to be done. Check out this article.
A rich person is not the one who has the most, but the one that needs the least.
|
|
|
|
|
I suggest you to take a luck at example from “msdn” documentation “MTMDI” that demonstrates an MFC User Interface Thread. For avoiding potential problems when programming multithreaded applications you need to respect some rolls or programming tips that is also described in “mfc” documentation.
Ex: - You can't have two threads manipulating the same object.., if you need this you need to protect such access with appropriate Win32 synchronization mechanisms...
- A thread can access only MFC objects that it created, a worker thread cannot perform a calculation and then call a document’s “UpdateAllViews” member function to have the windows that contain views on the new data modified, because the map from CWnd objects to HWNDs is local to the primary thread. There are several ways around this problem: you can pass individual handles (such as an HWND) rather than C++ objects to the worker thread, or you can create new user-defined messages corresponding to the different tasks your worker threads will be performing and post these messages to the application’s main window using PostMessage.
If this little help is not enough for your problem send me a sample of your code and I will help you.
CC.
|
|
|
|
|
I have a program that puts an icon in the tray. When someone locks the workstation the unlocks the station, the icon is gone though the process is still going. What causes this?
|
|
|
|
|
AUGH! I hate it when the description of the problem is vage.
It isn't when someone locks the screen, its when Windows locks up! You know, like when you are deleting a lot of big files in Explorer, it breaks, you tell the process to end, the entire screen goes blue, then the desktop appears.
Hope that makes more sense!
|
|
|
|
|
That happens because explorer restarts, you need to reinstall the icon. You can detect when this happens by handling "TaskbarCreated" message.
see:
http://www.microsoft.com/msj/0299/c/c0299.aspx
Edward.
|
|
|
|
|
Is it very difficult to take an existing relaively basic Visual C++ application and extend it to be accessible through a brwoser interface?
Can anyone point me to some FAQ or other resources?
Thank You!
|
|
|
|
|
Yes, and no. It all depends on your existing application. If you have a very modular backend, and preferably accessible through COM/dispatch interfaces, it's really easy to hack up an ASP interface. I guess there are other ways to add a web interface to your app. Managed C++ and ASP.NET comes to mind.
I think you should first asses the modularity of your application back end first. If it's not modular enough to support a totally different front end, you'll probably end up rewriting the whole thing anyway. Then it's better to realize that from the start and save some time.
--
Gott weiß ich will kein Engel sein.
|
|
|
|
|
|
That looks like a really cool piece of technology. And at the same time it makes me very sad knowing about this, while being stuck with J2EE.
--
Gott weiß ich will kein Engel sein.
|
|
|
|
|
I am writing a simple dialog-based application in Visual C++ & don't know how to get arguments for the program. E.g. if my program is executed as :
MyProgram.exe Param1 Param2
I would like to get Param1 and Param2
I know that in Console-based applications, there is a "main(argc, argv)" but couldn't find a similar method for my dialog-based applications.
I tried the GetCommandLine, but it seems like it only returns the path to the execution program (C:\Program Files\ ... \MyProgram.exe).
Thanks a lot for any help.
|
|
|
|
|
That should return the command line arguments as well...
There are global variables (declared in stdarg) that have the command line and should be available in any VC program:
__argc,__targv
John
|
|
|
|
|
hongheo76 wrote:
I know that in Console-based applications, there is a "main(argc, argv)" but couldn't find a similar method for my dialog-based applications.
They exist in Windows applications as well, just named __argc and __argv .
hongheo76 wrote:
I tried the GetCommandLine, but it seems like it only returns the path to the execution program (C:\Program Files\ ... \MyProgram.exe).
How are you using it? The docs indicate that it can be used in the manner in which you desire. I just tried it in one of my apps and it worked fine.
Is this an MFC application? If so, have you looked at CWinApp::m_lpCmdLine ?
A rich person is not the one who has the most, but the one that needs the least.
|
|
|
|
|
There's a member variable m_lpCmdLine in the CWinApp class, and it's public. So AfxGetApp()->m_lpCmdLine where do the work.
|
|
|
|
|
You can use the argv/argc stuff or use the Win32 API function GetCommandLine().
onwards and upwards...
|
|
|
|
|
Thanks a lot
I used CWinApp::m_pCmdLine and it worked.
|
|
|
|
|
Hi all, i am building an application and i need a web browser within the tool. I have added an activeX webbrowser control and it works just fine in my view class. However, when i try to access outside the view it either via a function or a pointer, i get the following assertion error:
ASSERT(m_pCtrlSite != NULL); // not an OLE control (not yet, at least)
if (m_pCtrlSite == NULL)
Can somebody please help me out. I've spent days on this stuff and i am well behind schedule.
Thank you;
Krugger
|
|
|
|
|
Sounds like you're trying to access the member before the view containing it has been created.
Steve S
|
|
|
|
|
I have develop a sniffer application in W2K
using a RAW socket and WSAIoctl with SIO_RCVALL
as follow:
WSAIoctl(m_Socket,
SIO_RCVALL,
&l_dwBufferInLen,
sizeof(l_dwBufferInLen),
&l_adwBufferLen,
sizeof(l_adwBufferLen),
&l_dwBytesReturned,
NULL,
NULL)
I'd like to port this application in WINNT but I've
found that SIO_RCVALL is not available in WINNT.
How can I set this option for my socket in WINNT ??
Is there something like this ??
Thanks a lot.
|
|
|
|
|
Interesting.
Well if the OS does not support it then you can try including all the require Win2k and newer version DLL with the installation.
Kuphryn
|
|
|
|
|
You'd have to include the whole network stack. Don't try it - these are critical system components, and are likely to break NT 4.0 systems (not to mention being unsupported).
|
|
|
|
|
Yeah I think there is no solution as well.
Kuphryn
|
|
|
|
|
How To Make the new DBase database(new DBase file)??? Where to read about this???
|
|
|
|