|
Is this a console or UI application?
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
DavidCrow wrote:
Is this a console or UI application?
look like to be CONSOLE application!
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
|
|
|
|
|
its a console application.
dudeoffrance
|
|
|
|
|
Ok, Budric's response was more or less correct. It's been six days. Has this been resolved?
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
I was just wondering how I could send an image over a winsock TCP socket (from client to server). I'm quite new to network programming but eagar to learn, so if anyone can help me I will be very greatful.
|
|
|
|
|
CSocketFile may do the job, like reading and writing files at either end.
Elaine
The tigress is here
|
|
|
|
|
If you are using RAW SOCKET, read whole image file in the STRING and then send it over the connected socket to other END. this really work!,One of My project using similiar FUNDA!
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
|
|
|
|
|
THank you for reading my question. Please help if you can:
I got a richtext box on a window, now while my code is processing files, it will display stuff on the richtext box to tell users what it is doing.
now if i grab it and move it around while it is processing, or click else where, then my richtext box wouldnt display anything anymore and the window becomes "not responding" while it is doing its things.
Now how do I make sure that the stuff will always be repaint and which events do I need to overwrite to take care of that? or do i need to send windows OS some commands to make sure that it doesnt make my window become "not responding"?
Please help
Elapid For The Win
|
|
|
|
|
You need to put the "processing files" code in a separate thread so that the main thread can handle the UI stuff.
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
how do I do that?
Elapid For The Win
|
|
|
|
|
See here and here.
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
I am attempting to create/update system variables in WinXP via the registery. I can add/update the variables and values just fine, however I cannot get the changes to recognized by the OS without rebooting. Now I have searched here and googled this question and everyone has the same answer....Use SendMessageTimeout to send a HWND_BROADCAST message with the WM_SETTINGCHANGE parameter. I have done this, but when I start another program that accesses the variable, the old value is still there... So it must be my program...But its hard to screw up a cut and paste of code so any ideas ?
for(int x=0;x<m_VarList.GetItemCount();x++)
{
if(IsDlgButtonChecked(IDC_USERRADIO))
SetEnvironmentalVariable(m_VarList.GetItemText(x,0),m_VarList.GetItemText(x,1),FALSE);
else if(IsDlgButtonChecked(IDC_SYSTEMRADIO))
SetEnvironmentalVariable(m_VarList.GetItemText(x,0),m_VarList.GetItemText(x,1));
}
if(IsDlgButtonChecked(IDC_FORCEUPDATE))
{
DWORD dwReturnValue;
long res;
res=SendMessageTimeout(HWND_BROADCAST, WM_SETTINGCHANGE, 0,(LPARAM) "Environment", SMTO_ABORTIFHUNG,5000, &dwReturnValue);
if(res!=0)
AfxMessageBox("System update was successful you will NOT have to reboot the computer");
else
AfxMessageBox("System update was successful, but you will have to reboot the computer");
}
CDialog::OnOK()
As you can see I've tried different combinations of broadcast messages, but the value still does not get updated. I'd appreciate any help you could provide.
The program I use that accesses the system variable was written for testing and consists of a single line of C# code
string Value=Environment.GetEnvironmentVariable("TEST_SYS_VAR");
|
|
|
|
|
Guinness4Strength wrote:
for(int x = 0; x < m_VarList.GetItemCount(); x++)
{
if (IsDlgButtonChecked(IDC_USERRADIO))
SetEnvironmentalVariable(m_VarList.GetItemText(x, 0), m_VarList.GetItemText(x, 1), FALSE);
else if (IsDlgButtonChecked(IDC_SYSTEMRADIO))
SetEnvironmentalVariable(m_VarList.GetItemText(x, 0), m_VarList.GetItemText(x, 1));
}
Since the state of the radio buttons will not change within this for() loop, why not put the if() statement outside of the loop?
In any case, since you indicate that the registry is being updated correctly, how is this other program accessing the registry such that it is not getting the updated values?
Also, if this other program is not running at the time the registry is being updated, the SendMessageTimeout(HWND_BROADCAST, WM_SETTINGCHANGE, ...) code is meaningless anyway.
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
DavidCrow wrote:
In any case, since you indicate that the registry is being updated correctly, how is this other program accessing the registry such that it is not getting the updated values?
If you look at the second code section of the originasl post I explain this. Its just a simple C# console program.
DavidCrow wrote:
Also, if this other program is not running at the time the registry is being updated, the SendMessageTimeout(HWND_BROADCAST, WM_SETTINGCHANGE, ...) code is meaningless anyway.
Well in a live situation running programs will need to know there is a change
Basically after I update the registry and send the broadcast (which is meaningless in my test scenerio) the C# program that attempts to access the environmetal variable does not return the correct value for the variable.
I would assume the broad cast message would force the shell/OS to update its values from the registry so the C# program would receive the new value.
|
|
|
|
|
Guinness4Strength wrote:
If you look at the second code section of the originasl post I explain this. Its just a simple C# console program.
Does GetEnvironmentVariable() read from the registry or from a cache? Try reading from the registry explicitly and note the results.
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
If I read from the registry its correct of course because getting the correct value in the registry has never been the issue.... The whole problem is forcing the cache to update. I have no control over how other blackbox programs get the environmental variables, so I need to assume that both the registry and cache must be updated.
|
|
|
|
|
Unless the other programs/processes are responding to the WM_SETTINGCHANGE message, there's nothing more you can do.
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
I was afraid of this. So there is no way to force Winodws "re-read" the registry to update its system variable values ?
|
|
|
|
|
No. This is akin to the "You can lead a horse to water but you can't make him drink it." adage. By broadcasting the WM_SETTINGCHANGE message, you've done your part. It's up to the other programs/processes to re-read from the registry if they see fit.
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
But what doesn't make sense is that even if I stop and start the programs that use the environmental variables after I've made the change to the registry the old value still persists. So the only thing I can assume is that the OS itself is not responding to the WM_SETTINGCHANGE message. Basically the whole point of this program was to allow a user to change environmental variables without having to reboot for them to take effect. So from what you saying this cannot be done.
|
|
|
|
|
Guinness4Strength wrote:
But what doesn't make sense is that even if I stop and start the programs that use the environmental variables after I've made the change to the registry the old value still persists.
Are those programs reading directly from the registry?
See here and here for more.
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
Thanks for the additional info, but since I'm neither touching the PATH variable nor am I using the SetEnvironmentVariable() API, it doesn't really get me any closer to solving this problem. I appreciate you efforts though Dave.
|
|
|
|
|
Guinness4Strength wrote:
...nor am I using the SetEnvironmentVariable() API...
Check your original post. Unless my eyes deceive me, I believe that SetEnvironmentVariable() is being used.
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
Your eyes do deceive you... I wrote SetEnvironmentALVariable(string,string BOOL)....its my own function
Basically just updates the
HKLM\\System\\CurrentControlSet\\Control\\Session Manager\\Environment key.
|
|
|
|
|
Guinness4Strength wrote:
Your eyes do deceive you... I wrote SetEnvironmentALVariable(string,string BOOL)....its my own function
Fair enough! Those two little characters were hiding behind the bushes.
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|