|
It sounds like you need to implement some sort of threading scenario, where your user interface operates on the main thread and the loop runs in a separate thread (which can be paused or restarted from the main thread.)
|
|
|
|
|
Have you tried _kbhit() in the loop?
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
|
|
|
|
|
Hi
I am trying to convert my networked application (C, using a custom text based protocol) to support UTF-8. I have search the Internet for a while now in order to find the best way to read UTF-8 from the socket, however, I have not been successful.
Can anyone point me in the right direction to get started? I have little experience with unicode programming in C, but know there exists a wchar_t type somewhere.
|
|
|
|
|
You don't want to use wchar_t for utf-8 encoded strings. Utf-8 was introduced to be able to use char .
I'd start from this link: UTF-8 and Unicode FAQ for Unix/Linux[^]. Never mind about the Unix part, it is useful even if you are working on Windows.
|
|
|
|
|
Sockets are used to transmit bytes of data. The socket API doesn't assume or impose any encoding, it's entirely up to the application level. If the application at the other end of the socket connection sends UTF-8 encoded data, then your recv() returns UTF-8 encoded data. There isn't any special "way to read UTF-8 from the socket".
|
|
|
|
|
Hello
I am working in a Win32 app using Visual Studio 2003.
And am using DialogBox function to create Modal dialogs. There's one dialog thats supposed to prompt the USER to whether Close the app or Not.
This is a high priority Dialog and i want it to displayed as the Top Most dialog irrespective of how many windows are open at a time.
Is there a way i can make this the TOP MOST window?
And also make all other opened windows invalid for the USER to make any Keyboard or Mouse clicks.
|
|
|
|
|
Superman did answer this question... you could have added to the conversation you've already started, instead of creating a new thread.
|
|
|
|
|
dipuks wrote: all other opened windows
In your app? That's what a modal dialog's meant to do. Make it a child of your app's topmost window.
dipuks wrote: Is there a way i can make this the TOP MOST window?
SetWindowPos[^]
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
Has anyone used CMFCRibbonStatusBarPane? Is there any way to force panes to update their text?
m_wndPane->SetText("my text"); will not update the UI..
You have to call:
m_wndPane->Redraw();
Wow!!!
ed
~"Watch your thoughts; they become your words. Watch your words they become your actions.
Watch your actions; they become your habits. Watch your habits; they become your character.
Watch your character; it becomes your destiny."
-Frank Outlaw.
modified on Saturday, July 11, 2009 8:04 PM
|
|
|
|
|
Hey Friends
Any idea how to get default command for any given file type
e.g for .cpl shell command is open with control panel
or
for .txt shell command is Open
Any sample / example can be of real help
Regards
|
|
|
|
|
You mean what ShellExecute[^] does, except without actually performing the command? I don't know of anything that does that, probably because the only thing you really want to do with a command like that is execute it.
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
As Stuart said, you probably just want to execute the file using ShellExecute .
The command for the default operation is stored in the registry.
You should be able to read it for most of the file types.
There is no guarantee that all file types have this information.
Here goes -
Open the HKEY_CLASSES_ROOT registry key.
This hive will have a subkey with the extension of a file like .txt or .cpl
The default value of this key will contain another value like txtfile for .txt files and cplfile for .cpl files.
The HKEY_CLASSES_ROOT key also has subkeys with these values like txtfiles and cplfiles.
These subkeys in-turn will have a subkey called shell.
The subkeys of shell contain the names of the supported commands like Open, Runas etc.
Each of these keys contain a subkey called command whose default value is the actual command that is executed.
«_Superman_»
I love work. It gives me something to do between weekends.
|
|
|
|
|
yeah thanks will give it a try
so whatever extension (xxx)
i will append like
xxxfile
and then will follow the above procedure
in case i do not find the shell command, i will use open
shellexecute is used at lots of places, however with metacafe, i got warning saying your program is going to change something into shell
|
|
|
|
|
vikrant kpr wrote: so whatever extension (xxx)
i will append like
xxxfile
Wrong.
Please read my earlier post carefully.
The default value of the extension (.xxx) will contain the name to search.
It may not always be xxxfile. It could be xxxyyy
«_Superman_»
I love work. It gives me something to do between weekends.
|
|
|
|
|
hey buddy
that's really great
now i get it and thanks for the correction
HKEY_CLASSES_ROOT\.cpl ' default value reads cplfile
and
then to read
HKEY_CLASSES_ROOT\cplfile\shell\cplopen ' default value can be passed to shellexecute
now the trick seems to find the name cplopen as the shell key can have many subkeys
rest all seems good
|
|
|
|
|
To use ShellExecute on .cpl you simple do this
ShellExecute(NULL, _T("open"), _T("cplfile.cpl"), NULL, NULL, SW_SHOW);
The API will take care of finding out the command for it.
You do not need to do this yourself.
«_Superman_»
I love work. It gives me something to do between weekends.
|
|
|
|
|
that's the issue
cplfile does not have shell command named Open
it has Open with Control Panel shell command
now even with above both items, it is not invoking the control panel item
//ShellExecute(NULL, _T("Open with Control Panel"), _T("c:\\windows\\system32\\main.cpl"), NULL, NULL, SW_SHOW);
ShellExecute(NULL, _T("Open"), _T("c:\\windows\\system32\\main.cpl"), NULL, NULL, SW_SHOW);
it seems
it would require
control.exe to be passed in with open and pass the cpl file as parameter
|
|
|
|
|
it works as given below
ShellExecute(NULL, _T("Open"), _T("control.exe"), _T("main.cpl"), NULL, SW_SHOW);
however
that does not make it generic
|
|
|
|
|
I don't know if this will help you but using FindExecutable() you can get the program that is associated with a file without looking in the registry
Rozis
|
|
|
|
|
hey buddy
thanks a lot, yes that function sound promising, will give a try and will post results here.
regards
|
|
|
|
|
Hello,
After i start a new EXE by calling the ShellExecute function, is it possible
for me to close or destroy that process by using another function?
Is there a function that does that?
Thanks
|
|
|
|
|
Use ShellExecuteEx[^] instead of ShellExecute, as you can get a process handle using that function.
You can then manipulate the process with that handle - to destroy it, call TerminateProcess[^].
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
I'm using CArray - derived classes in my app. I have bug somewhere I cannot reproduce, I think it could be accessing CArray by index out of range (but I'm not sure). When I do so, default implementation CWinApp::ProcessWndProcException() displays the "An invalid argument was encountered." and after confirming program continues which is bad.
What I need to do is to make my program to crash, because I have exception handler in my app which creates and sends crash dump to me and I need to see which access to array caused the exeption. How can I disable default CException* handler?
I've overriden my ProcessWndProcException() and put THROW_LAST and also just "throw" but it didn't help. Message box was not displayed but nothing happened, program does not crash. Putting "int 3" into handler does not help, because it crashes but I cannot see in stack trace where was bad access to the array, just useless exception hadler. Any idea what could I do?
I don't want to add try/catch to each array access, there are dozens of that in program
Thank you.
|
|
|
|
|
What you want to do is to run your app under the debugger and get the debugger to break when an exception is thrown (the Debug->Exceptions menu item (IIRC) opens a dialog that allows you to do this.
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
I do not want to run it in debugger, I want it to run at customer's computer and send me the correct crash report (currently working for unhandled non-CException exceptions)
|
|
|
|