|
Hi all,
I want to make enteries in Add or remove programs(control panel)Programmatically.
how can i do this???
Thanks in advance
|
|
|
|
|
CRegEdit is class that would help you add your entries in the Registry location
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow Never mind - my own stupidity is the source of every "problem" - Mixture
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief and You/xml>
|
|
|
|
|
These day i practice ACM problem.
and many times, i can't understand problem.
i am studying by "Programming challenges" book.
but that book only give me problom, not answer.
what i want to say is i want to know tip.
May be there are people who solve problom, and i don't want to code or source, i just want to know how they can solve that problem.
so, do you know website about ACM problom and tip?
firstly, i am sorry, i am from korea.
and i am not good in wriitting english so please understand~
Thank you everyone~
|
|
|
|
|
You can try posting a specific problem in the Mathematics and Algorithms forum and ask for a tip. There are many people there that will help you.
|
|
|
|
|
Hi,
Why ShellExecuteEx is suggestible to use over CreateProcess,WinExec in Vista. What is the disadvantage if I still continue to use CreateProcess,WinExec in Vista.
Thanks,
Venkat
|
|
|
|
|
WinExec function is provided only for compatibility with 16-bit Windows. So even if you are using windows XP, you should not use it.
venkat.kupunaram wrote: Why ShellExecuteEx is suggestible to use over CreateProcess
who suggested?
|
|
|
|
|
CreateProcess gives you more control over the spawned process u start, you can spawn it as a different user or different security priveledges and a whole lot more.
"Any intelligent fool can make things bigger, more complex, and more violent. It takes a touch of genius and a lot of courage to move in the opposite direction." -Albert Einstein
|
|
|
|
|
Roughly speaking:
-ShellExecute is more developer-friendly.
-CreateProcess gives the developer more control.
I don't know about particular issues related to Vista OS .
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
Hello,
i have the following problem (i think it is a beginner question but i hope to get an informative answer!)
Actually i try to get the BatteryDeviceName of my notebook. I use the code snipped from the MSDN.
But at these step iam hanging because the DeviceIoControl returns a BATTERY_INFORMATION structure, because the InformationLevel (bqi) is set to BatteryInformation. BUT I want the BatteryDeviceName, so I changed the Information Level. Then the IOCTL_BATTERY_QUERY_INFORMATION should return a null terminated unicode string.
My question is how can i store this ?string?
Here is my code:
BATTERY_INFORMATION bi = {0};
bqi.InformationLevel = BatteryDeviceName;
if(DeviceIoControl(hBattery,IOCTL_BATTERY_QUERY_INFORMATION,&bqi,sizeof(bqi),&bi,sizeof(bi),&dwOut,NULL))
{
MessageBox(NULL,L"#8 - IOCTL_BATTERY_QUERY_INFORMATION ... OK",L"",MB_ICONINFORMATION);
MessageBox(NULL,L"[BatteryDeviceName should be here !!!]",L"",MB_ICONINFORMATION);
}
As you can see i need to replace the bold line or more to store the String.
I hope someone can help me.
Thanks,
gabbana
|
|
|
|
|
Maybe something like this:
wchar_t szBatteryDeviceName[260];
bqi.InformationLevel = BatteryDeviceName;
if(DeviceIoControl(hBattery,IOCTL_BATTERY_QUERY_INFORMATION,&bqi,sizeof(bqi),szBatteryDeviceName,sizeof(szBatteryDeviceName),&dwOut,NULL))
{
...
}
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Great thank you, but i have one problem:
If I use the szBatteryDeviceName in the MessageBox, he prints the correct batterydevicename but adds a part of the application path, so i think it ignores the null terminated string ?
|
|
|
|
|
Interesting - I wouldn't expect that.
I guess you could add the null terminator yourself:
wchar_t szBatteryDeviceName[260];
bqi.InformationLevel = BatteryDeviceName;
if(DeviceIoControl(hBattery,IOCTL_BATTERY_QUERY_INFORMATION,&bqi,sizeof(bqi),szBatteryDeviceName,sizeof(szBatteryDeviceName),&dwOut,NULL))
{
szBatteryDeviceName[dwOut/sizeof(wchar_t)] = 0;
...
}
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Ahh now it works fine.
Great help, thanks!
bye,
gabbana
|
|
|
|
|
Okay,
now i tried this with another type. I only get -1 as seconds, i am not sure if this is for a constant that the estimatedtime value is not available, but is the way correct for getting them:
estimated time should return as an ULONG.
ULONG estimatedtime;
bqi.InformationLevel = BatteryEstimatedTime;
DeviceIoControl(hBattery,IOCTL_BATTERY_QUERY_INFORMATION,&bqi,sizeof(bqi),&estimatedtime,sizeof(ULONG),&dwOut,NULL);
wchar_t szestimatedtime[260];
wsprintf(szestimatedtime,L"%d seconds",estimatedtime);
MessageBox(NULL,szestimatedtime,L"",0);
Thanks for help!
bye,
gabbana
|
|
|
|
|
gabbana wrote: I only get -1 as seconds
-1 == 0xFFFFFFFF == BATTERY_UNKNOWN_TIME (BatClass.h)
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
From MSDN, if the estimated time is unknown (for example, the battery is not discharging and the AtRate specified was 0) this will return BATTERY_UNKNOWN_TIME .
"Love people and use things, not love things and use people." - Unknown
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
How can I capture the default keys on a windows mobile phone that open messaging, internet explorer and even start button.
I want to be able to capture those and then disallow windows itself to open messaging application.
I know this is bad to do but I have to make an app to lock phone and I cannot allow any other application to be run by user.
Thanks in advance
-----------------------------
In my dream, I was dorwning my §orrow§
But my §orrow§, they learned to §wim
|
|
|
|
|
Both are aready in XP style.
BTW, I don't understand why M$ make them differenct in width.
system
|
|
|
|
|
CComboBox wraps the Windows combo box control.
CMFCColorButton is a control implemented in a library.
Why the author(s) chose not to use the system width metric, I don't know.
CMFCColorButton was not written by Microsoft AFAIK.
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Hello everyone,
For the following code, I can not set breakpoint in release mode, but the same command in WinDbg works fine in debug mode. Anything wrong?
Here is my Windbg command and output in release mode and source codes. I have tested in release mode breakpoint at foo does not take effect, but in debug mode it takes effect.
0:000> bp foo
Bp expression 'foo' could not be resolved, adding deferred bp
0:000> bp main
0:000> bl
0 eu 0001 (0001) (foo)
1 e 00000001`40001000 0001 (0001) 0:**** Test64bitDebug!main
int foo (int a, int b)
{
return a+b;
}
int main()
{
int a1 = 100;
int b1 = a1 + 100;
a1 = foo (a1, b1);
return 0;
}
thanks in advance,
George
|
|
|
|
|
Hi George,
could you please tell us why you need breakpoints for release mode applications? You also have the debug mode to debug your application. Don't you think is enought?
Best regards,
Mihai Moga
|
|
|
|
|
Thanks Mihai,
Because in real test environment, we need to work with release mode code, not debug mode code. Anyway, any ideas to my original question?
regards,
George
|
|
|
|
|
Hi George,
I do not have an answer to your original question, but did you read Keith Rule's Debugging Release Mode Problems[^] article?
Best regards,
Mihai Moga
|
|
|
|
|
Thanks Mihai,
I read through the article, looks great! A few more comments,
1. We could only use VERIFY in MFC based application, corrrect?
2. In the article it is mentioned "In my personal experience, I've rarely seen a problem that really was bad code generation. My experience with VC++ 6.0 has been that the compiler occasionally asserts while generating code (especially when using templates), but I've not experienced any problem with my code associated with bad code generation. Installing service release 3 seems to have taken care of all the code generation asserts that I've seen in previous versions."
What means "asserts" here?
regards,
George
|
|
|
|
|
Hi George,
to answer to your questions I gently ask you to read couple more articles:
a) Rob Manderson's Assert is your friend[^]
b) srana's MFC Windows Coding Guidelines[^]
Best regards,
Mihai Moga
P.S. YES, you should use only
VERIFY to ensure that your code goes to release version of your application; use
ASSERT only for definitions/expressions/assertions.
|
|
|
|
|