|
You can get all the drives in your local system using the GetLogicalDrives[^] function.
Show all the available drives in a combo box and have the user select one from it.
«_Superman_»
I love work. It gives me something to do between weekends.
|
|
|
|
|
Here is the class declaration.
There is no any interesting point.
class Sample
{
protected:
struct State
{
int q;
long a;
char z;
};
State m_state;
public:
Sample(){ Create();}
~Sample() { Destroy(); }
void Create()
{
m_state.q = 10;
}
void Destroy()
{
}
int getINT(){return m_state.q;}
};
But here is interesting. What is this???. Decleration. Definition. I Dont understand and i dont find any information about this part.
<code>
Sample& GetSample()
{
static Sample state;
return state;
}
</code>
The orginal parts of this code. in Directx SDK DXUT.cpp
Thank You!!!
|
|
|
|
|
- It declares and defines the function GetSample
- The function declares and defines a local static variable called state. As it's static, this variable retains it's value after the function exits even though it's local to the function
- The function returns a reference to state. It looks like it's trying to implement some sort of a singleton for the class Sample
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
I plan on writing a command line program that will do some large, time consuming number crunching.
Now to keep it simple, lets say when I start my program all its going to do is count from 1 to infinity. Normally, when its running the loop it will "freeze" the program, per se, and not allow any additional user input until its done with the loop. However I would like the user to have the option to "pause" the loop without crashing to program. What is a simple way to interrupt a loop?
|
|
|
|
|
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
|
|
|
|