|
Is there some way change display font setting (dpi), programatically, without restarting windows.
|
|
|
|
|
My colleague hacked an undocumented function about changing fonts in WinNT.
However, in WinNT you have to restart windows.
Maybe, restart is not required on win2K or winXP.
So, read Changing Windows NT Font's Size
|
|
|
|
|
|
Dear All,
Can some body suggest some suitable soultion to below ?
I developed an application to restore wallpaper settings and made this application run as a SERVICE. I am doing following procedure to accomplish this task:
1) Copy HKEY_CURRENT_USER\Control Panel\Desktop
ie . Copy the desktop registry key
2) Saving it to HKEY_LOCAL_MACHINE\SOFTWARE\Desktop
ie. saved it to another key
Now a copy of desktop setting registry is saved in another key.
Now I make changes to my desktop settings. And the value get changed in HKEY_CURRENT_USER\Control Panel\Desktop
3) To restore back my original settigs I restore back the registry (from the copy i made)
ie. Restore registry
On clicking Restore buttton I restore the settings back ie. i copy
HKEY_LOCAL_MACHINE\SOFTWARE\Desktop back to
HKEY_CURRENT_USER\Control Panel\Desktop
--------My problem is that---
If i run this program without making it as a service, then it runs properly. But if I run this program as a service then it doesnot work because I am not able to make changes in HKEY_CURRENT_USER. ie. service doesnot allow.
Is there any other way to restore desktop settings . In any case the program should run as a service.
--------------------------
Please suggest some alternatives.
Rohit
|
|
|
|
|
It's because the service runs as the local system user.
The only way to do what you want, is to make the service log on as a user, then it can change the wallpaperfor that user...
- Anders
Money talks, but all mine ever says is "Goodbye!"
|
|
|
|
|
Friends,
Since I am new to SDK I have this doubt. Can we store the string, which we have entered in the “EDIT” window? I have been creating a full application in win32asm. I want to store the contents of the “EDIT” box and append it to the SQL statement. I don’t know how can I store the “EDIT” box content that is text entered in EDIT box.
Help.
|
|
|
|
|
This is a Visual C++ forum. Not an ASM forum...
Rickard Andersson@Suza Computing
C# and C++ programmer from SWEDEN!
UIN: 50302279
E-Mail: nikado@pc.nu
Speciality: I love C#, ASP.NET and C++!
|
|
|
|
|
That is OK since the functions are the same from .dll files. All win32asm does is call the .dll function during the run time. If some body knows how to retrieve the text inputted in “EDIT”. I was searching the MSDN (platform SDK) but I cannot make a way.
|
|
|
|
|
IF you are using the common edit control/box. Then sending a WM_GETTEXT command to the edit cotrol will work. Some edit controls require you to first select the text, via a function call, that you what to copy and the call a function like GetSelectedText(). All of this information should be available online at microsoft, incase you do not have access to the MSDN library.
Trust in the code Luke. Yea right!
|
|
|
|
|
Hello All,
When I am playing around the Microsoft's demo program "walkall", I include its CApp and CWinSink class into my program (as two classes). And in my program, I write a procedure (such as MyParse()) that calls the modified main function in the original walkall program (which now, is a ordinary function of the CApp class in my program).
I find that when I first run MyParse(), all goes good. When I run it again, no result. After debuging, I find the call to "CoCreateInstance" in the walkall (which is a class of my program) will fail when it is called in a second time.
As I am quite unfamiliar with the COM and related thing, can anyone know what is the most possible reason for it?
From the MS help, it says the "CoCreateInstance" will return 3 possible results:
S_OK
REGDB_E_CLASSNOTREG
CLASS_E_NOAGGREGATION
However, I checked the returned value, it is none of the above three values.
How can I know why CoCreateInstance will fail?
Thanks a lot.
And have a nice day.
|
|
|
|
|
The return value from CoCreateInstance is an HRESULT, which normally contains error information. Get the return value, then you can look it up in the error lookup program (from the Tools menu in VC6).
Dave
http://www.cloudsofheaven.org
|
|
|
|
|
As said by Dave, CoCreateInstance() can return any possible HRESULT value. The most common HRESULT values are S_OK , S_FALSE and E_FAIL . You can use the error look up table or check the hr value of your returned HRESULT in your watch window while debugging.
For example:
<br />
HRESULT hRes = CoCreateInstance(.....);<br />
insert in your watch, a variable hRes,hr and check the error string when you pass the CoCreate statement.
Also make sure you are specifying proper parameters to CoCreateInstance and that you are releasing the referrence count using Release() method after the first time creation of your component using CoCreateInstance .
@!$h@
|
|
|
|
|
Thanks a lot for Dave and Aisha.
I checked the returned value of HRESULT, which is -2147023486, and the error lookup program explains it as "Class already exists".
I am not sure what does that mean? I think I have released all the resoures. Is there any way to check what class does the error refer to?
By the way, can you explain a little of "releasing the referrence count using Release() method after the first time creation of your component using CoCreateInstance". How normally it is done? (it is my first time to do this COM related programming so I am not very sure of these things. That's why I use the walkall demo source a lot).
Thanks a lot.
PS: I belive the parameters to CoCreateInstance is correct. It is called like:
if (FAILED(hr = CoCreateInstance( CLSID_HTMLDocument, NULL,
CLSCTX_INPROC_SERVER, IID_IHTMLDocument2,
(LPVOID*)&g_pApp->m_pMSHTML )))
{
// here I can watch the hr's value.
goto Error;
}
|
|
|
|
|
I think you are probably not releasing your pointer reference. The call to CoCreateInstance() is correct.
When you first time call CoCreateInstance(), do with your g_pApp->m_pMSHTML pointer whatever you want and then when you are finished, simply do the following:
g_pApp->m_pMSHTML->Release();
make sure you have been released your pointer before you second time call your CoCreateInstance().
all the best!
@!$h@
|
|
|
|
|
I think you are probably not releasing your pointer reference. The call to CoCreateInstance() is correct.
When you first time call CoCreateInstance(), do with your g_pApp->m_pMSHTML pointer whatever you want and then when you are finished, simply do the following:
g_pApp->m_pMSHTML->Release();<br />
g_pApp->m_pMSHTML = NULL;<br />
make sure you have been released your pointer before you second time call your CoCreateInstance().
all the best!
@!$h@
|
|
|
|
|
Thanks a lot.
I found out that the reference count is not set to 0 before release.
(I doubt that the "release" will not return any error if the count is not 0).
From the debug window, I found the reference count is 1 before release. I tracked it step by step and found out the wrong place.
Thanks a lot for Aisha and Dave and all the people's kind help.
Have a nice day.
|
|
|
|
|
Kevein wrote:
Thanks a lot for Aisha
you are most welcome
Kevein wrote:
Have a nice day.
thanks, you too
@!$h@
|
|
|
|
|
It's been a long day and I'm now officially brain dead!
I've got an MFC Extension dll as a project in a solution. The extension dll calls several WinInet functions. I have included wininet.h in the stdafx.h file and linked to wininet.lib in the ../vc7/platformSDK/lib folder.
I'm getting LNK2019: Unresolved external symbol on my first call to the library... InternetGetConnectedState(...)
What have I forgotten to do?
Paul Lyons, CCPL Certified Code Project Lurker What a long, strange trip it's been - Robert Hunter
|
|
|
|
|
do you get the same error with other wininet functions, like say InternetOpen, or only with that function?
.... If its only with InternetGetConnectedState then try InternetGetConnectedStateEx... it might have been deprecated without warning in VC7 or somethin
|
|
|
|
|
Hi all,
I have a problem. I have written a program that uses a commercial activeX component. I need to distribute this program on other machines and in order to do that I need to also distribute the commercial .ocx file and register it.
This is no problem.
What I want to do is for my program to send a popup error message if the ocx file is not installed/registered with windows.
Currently it just crashes.
thanks
---
|
|
|
|
|
why not do a cocreateinstance and catch any errors/exceptions
Bryce
|
|
|
|
|
It crashes at
TRY {<br />
CModelessMain::Create(...)<br />
}<br />
CATCH_ALL<br />
{<br />
<t>...<br />
}<br />
END_CATCH_ALL<br />
Never tried CoCreateInstance - will give it a go
---
|
|
|
|
|
Create() method returns a BOOL , If you have specified appropriate parameters, the method does not crash. So better check for your parameters. In case the control is not registered, Create returns a FALSE . In this case, give user the message that control is not registered or installed.
@!$h@
|
|
|
|
|
bryce wrote:
why not do a cocreateinstance and catch any errors/exceptions
Ok How do I do that????
---
|
|
|
|
|
You can create an object of your control using COM techniques:
HRESULT hr = CoCreateInstance(<br />
CLSID_YourControlID, <br />
NULL, <br />
CLSCTX_INPROC_SERVER, <br />
IID_IYourControlInterface, <br />
(void**)&pInterfaceName);<br />
<br />
if (FAILED(hr)) {<br />
MessageBox(<br />
NULL, "Failed to create instance of " "Your Control", "Error!", MB_ICONERROR);<br />
}
For that you need to know the basics of COM. MSDN is a good source of learning so read about the basics of COM.
All the best!!
@!$h@
|
|
|
|