|
Hi to all...
I want to create a timer in visual c++ (without using the class CWnd)that periodically send a message (for example a string). How is the best solution?
I thought....create a thread that stay in sleep and after this time sleep send the message...
I'll wait for any suggetion..
thanks!!
|
|
|
|
|
see the API CreateTimerQueueTimer
"What classes are you using ? You shouldn't call stuff if you have no idea what it does" Christian Graus in the C# forum
led mike
|
|
|
|
|
My suggestion is to use a waitable timer.
You create a waitable timer with a call to ::CreateWaitableTimer()[^].
Wait for the timer to be signalled with ::WaitForSingleObject() or similar.
If you're using a secondary thread you may want to stop the timer and exit the thread.
I suggest you signal an event for that, created with ::CreateEvent().
Unless you're familiar with multithreading I suggest you read Joe Newcomer's article[^] on the subject to avoid the most common pitfalls, such as avoiding ::sleep() as the plague and never call GUI related stuff from a worker thread.
Hope this helps
--
Roger
It's supposed to be hard, otherwise anybody could do it!
Regarding CodeProject: "resistance is pointless; you will be assimilated"
|
|
|
|
|
You could always try timeSetEvent to create a multimedia timer -- I have used that from time to time. That essentially creates the new thread for you and calls a function you specify when it times out. Saves you some of the details about thread management.
|
|
|
|
|
1. U can use the api : SetTimer() / KillTimer()
2. U can use the multimedia timer : timeSetEvent() / timeKillEvent()
Chinese coder.
|
|
|
|
|
Castello07 wrote: I thought....create a thread that stay in sleep and after this time sleep send the message...
I Believe that will be right way, as this will not interrupt your main thread when you call sleep function!
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
|
|
|
|
|
Hi
I want to put the PC into Standby Mode. When I do that the following error:
System Standby failed
The device driver for the "Alcatel Multimedia Keyboard gateway' device is preventing the machine from entering standby. Please close all applications and try again. If the problem persists, you may need to update this driver."
Could you please resolve this issue.
Thanks in advance.
Raja Ratheesh
|
|
|
|
|
rajanponnalagu wrote: The device driver for the "Alcatel Multimedia Keyboard gateway' device is preventing the machine from entering standby.
Some device drivers are designed not supporting S3 State (Standby). When Windows requests all the devices to enter S3 state, these device drivers reject the request and issue some error code.
1) You may check if there any newer driver released by Alcatel for your keyboard gateway.
2) You may write an email to Alcatel customer support to find out if the driver supports Standby.
Maxwell Chen
|
|
|
|
|
I have a simple MFC Appwizard exe application. I specify the "Release" directory for intermediate files and output files. However I specify altogether different directory,say "OutPut", for output .exe file. and I want that only .exe file should be be generated in this directory. However I observe that .exp file and .lib file are also generated at the same location as the .exe file. I could not find any option in project settings for specifying the path for .exp and .lib file.
This problem doesn't arise if its Appwizard dll.
How can one solve this issue.
Thanks!
Suyash
|
|
|
|
|
Here's one way you could do it
Open the project properties and go to Configuration Properties->Linker->General. Then set "Output File" to $(ProjectDir)OutPut/$(ProjectName).exe
|
|
|
|
|
I am doing exactly the same thing as you suggested, however its not working out
|
|
|
|
|
So just to be clear here are the settings I'm using to get this to work
(for the Release configuration)
Configuration Properties->General
Output Directory = Release
Intermediate Directory = Release
Configuration Properties->C/C++
Object File Name = $(IntDir)/
Configuration Properties->Linker->General
Output File = $(ProjectDir)OutPut/$(ProjectName).exe
Is that what you're using?
|
|
|
|
|
in short I want to automatically copy files needed for my application from a central "repository" to the output folder (debug or release )of my application when it is build, and also, if the application is build, and a file is changed in the "repository" copy the modified file to the output folder of the application.
I have a custom build command in my VC6 project that does a xcopy of some files to the output directory of my project.
in VC6 :
command :
copy $(InputPath) $(IntDir)\$(InputName).exe
xcopy /D /e /y C:\folder\*.* ..\..\bin\debug\
output :
$(IntDir)\$(InputName).exe
..\..\bin\debug\
if I try to do the same thing in VS.net 2003, in the I get the following error :
my_project : error PRJ0032 : The 'Outputs' property for the project-level custom build step contained '..\..\bin\debug\' which evaluates out to '..\..\bin\debug\'.
Am I doing the right thing at the right place ?
Thanks.
Maximilien Lincourt
Your Head A Splode - Strong Bad
|
|
|
|
|
Do you know what the current directory is when the custom build step is executed? I would guess the current directory when executed in VC6 is different than VC2003.
One thing you could try is hard-code "..\..\bin\debug\" to the full path and see if that works.
|
|
|
|
|
I've got a problem.
I Want that when you press the button (see link plz) open a pdf file with the instructions of use.
http://www.imagecash.net/image.php?file=265709030
I can open file use this code
<br />
ShellExecute(this->m_hWnd,"open",<br />
"C:\\motor.pdf","","",SW_SHOW );
But this program is to use for many people, and the path changes computer to computer.
How can I solve this?
How can I make a setup that includes MFC files with microsoft visual studio 6?
thx
|
|
|
|
|
You can open the file Open dialog
Ask the user to select the file to open
Get the path from that fileopen dialog.
and then use ShellExecute with that path
Somethings seem HARD to do, until we know how to do them.
_AnShUmAn_
|
|
|
|
|
Holy cow !! When posting, inform people that your link contains not worksafe contents !
marcogja wrote: But this program is to use for many people, and the path changes computer to computer.
That seems logical no ? It won't start a search on your computer to find the required file. Supply the file with the program and put it in a specific folder where it can be found, that's the standard solution.
marcogja wrote: How can I make a setup that includes MFC files with microsoft visual studio 6?
Does that have something to do with your previous question ? If yes, I don't understand.
Cédric Moonen
Software developer
Charting control
|
|
|
|
|
marcogja wrote: can open file use this codeShellExecute(this->m_hWnd,"open","C:\\motor.pdf","","",SW_SHOW );
either keep that path in any inifile or ask user about file path when ever you Application run!
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
|
|
|
|
|
J have an application in MFC. There is one dialog window.
I want to hide the icon "close" which is inthe right upper corner of the window. What I have to do in my programm?
Regards
|
|
|
|
|
take the properties of the dialog in resources..
in the style tab uncheck the System menu check box..;)
nave
|
|
|
|
|
Yes, I know, thank you, but I want to know how to do it in the code source.
Regards
|
|
|
|
|
When u want to remove the close menu.
write
ModifyStyle( WS_SYSMENU,0 );
nave
|
|
|
|
|
When you want the Sysmenu to be visible
SetWindowLong(GetSafeHwnd(),GWL_STYLE,WS_SYSMENU | GetWindowLong(GetSafeHwnd(),GWL_STYLE));
RedrawWindow(NULL, NULL,RDW_ERASE | RDW_INVALIDATE | RDW_FRAME | RDW_ALLCHILDREN); When you don't want the Sysmenu to be visible
SetWindowLong(GetSafeHwnd(),GWL_STYLE,~WS_SYSMENU & GetWindowLong(GetSafeHwnd(),GWL_STYLE));
RedrawWindow(NULL, NULL,RDW_ERASE | RDW_INVALIDATE | RDW_FRAME | RDW_ALLCHILDREN); Hope this helps you
Knock out 'T' from CAN'T ,
You 'CAN' if you think you 'CAN'
|
|
|
|
|
i am trying to read the path of installation of adobe acrobat from the registry( is there any other way), in order to launch it in my program. i have tried RegQueryInfoKey to get the value from
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\AppPaths\AcroRd32.exe
from the default string in this key. were the path is.
but i am unable to read the value.
please help
|
|
|
|
|
Hi,
In which way do you want to read out any value using RegQueryInfoKey ?
To read value use RegQueryValueEx.
-----------
Mila
|
|
|
|