|
using namespace Gdiplus; // note the lower case 'p'
"You're obviously a superstar." - Christian Graus about me - 12 Feb '03
"Obviously ??? You're definitely a superstar!!!" mYkel - 21 Jun '04
Within you lies the power for good - Use it! Honoured as one of The Most Helpful Members of 2004
|
|
|
|
|
I have included using namespace Gdiplus; in the stdafx.h file,
but now there comes another error....
Linking...
LINK : fatal error LNK1104: cannot open file "C:\Program.obj"
Error executing link.exe.
TryGdipp.exe - 1 error(s), 0 warning(s)
what's that about???
thank you very much!
|
|
|
|
|
|
|
Whilst I can get all the processes running on my workstation and hence a handle to the process, and the .EXE name. How can I get the commandline arguments for that process ?
I'm trying to write an app so that I can identify the processes better, as we have several wscript.exe scripts run at login time, but some need to be killed by the user after login, any help would be gratefully received.
|
|
|
|
|
|
This is just what I was looking for, many thanks it is much appreciated.
|
|
|
|
|
|
I have made deskband object. How to programmatically show and hide it?
If that was explorer bar, i'd use IWebBrowser2::ShowBrowserBar.
Thank you!
|
|
|
|
|
Did you ever get an answer?
|
|
|
|
|
Just for learning purposes, I'm trying to implement the code Mark Petrik Sosa put in a message at 6:47 14 Apr '05 in a reply to 'Send Messages to Other Windows' (4:34 14 Apr '05).
<br />
HWND hNotepad = FindWindowEx(0, 0, "Notepad", 0);<br />
if(hNotepad)<br />
SendMessage(hNotepad, WM_SETTEXT, 0, (LPARAM) "Hah, I found you!");<br />
else<br />
MessageBox(0, "Couldn't find notepad.", "Darn", MB_OK);<br />
<br />
When I compile, I get:<br />
error C2440: 'initializing' : cannot convert from 'CWnd*' to 'HWND'<br />
error C2660: 'CWnd::SendMessageA': function does not take 4 arguments<br />
<br />
If I change to <br />
CWnd* hNotepad = ...<br />
and then<br />
SendMessage(hNotePad->m_hWnd, ...<br />
I still get the C2660 error.<br />
<br />
I also get<br />
'CWnd::MessageBoxA': function does not take 4 arguments<br />
I can see that SendMessage has 2 prototypes - one takes 3 arguments and looks like it's for the cases where you do not need to specify a handle.
Would appreciate any direction on how to fix the code and/or explanations to help me understand the mechanisms involved here.
|
|
|
|
|
::SendMessage(hNotepad, WM_SETTEXT, 0, (LPARAM) "Hah, I found you!");
and
::MessageBox(0, "Couldn't find notepad.", "Darn", MB_OK); or MessageBox("Couldn't find notepad.", "Darn", MB_OK);
|
|
|
|
|
Thanks.
It now compiles and executes properly.
If you have another minute though, I still get the error 'initializing': cannot convert from CWnd* to HWND unless I declare hNotepad as CWnd*. Then when I do that I have to use hNotepad->m_hWnd, which makes sense. Is there some include file I need such that I can declare hNotepad as HWND and then use it as you and Mark used it (i.e., without the ->m_hWnd)?
|
|
|
|
|
If you dereference your pointer ( *hNotepad ), then operator HWND should come to the rescue.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
I haven't found the secret yet. If I still declare with CWnd
<br />
CWnd* hNotepad = FindWindowEx(...<br />
then I can use
<br />
::SendMessage(*hNotePad, ...<br />
But if I declare with
<br />
HWND hNotepad = FindWindowEx(...<br />
or
<br />
HWND *hNotepad = FindWindowEx(...<br />
I still get the error message
'initializing' cannot convert from CWnd to HWND
Is it maybe because the 2003 compiler is more strict than compilers in the past? I don't have much experience/history with Visual C++.
|
|
|
|
|
Has anyone ever tried (and managed) passing the IP number of the remote machine instead of the machine name in the remote filename url?
I can successfully create a BITS job when i specify the remote file using the machine name in the url, but somehow the job cannot be created when i specify the ip number of the same machine in the url instead of the name. Any ideas anyone?
(If it can help, the remote machine ip is dhcp-assigned, but i don't think this can create a conflict)
|
|
|
|
|
Hi,
How can I get the DWORD or Binary Value using RegQueryValueEx function?
Cheers,
Thanks.
|
|
|
|
|
<code>DWORD dKeyValue;
DWORD dType;
DWORD dSize=sizeof(DWORD);
RegQueryValueEx( hKey, "KeyName", NULL, &dType,
reinterpret_cast<LPBYTE>(&dKeyValue), &dSize)</code>
suhredayan
|
|
|
|
|
Hi guys
I'm working in an app that starts to be big and I have a little-big problem.
When I touch an .h file the VC++ 6.0 recompiles practically the complete app.
Why do you think this is due to?
There is some Setting to change?
Is due to includes?
Some clue?
Have you experimented this too?
Thanks in forwarding
Doc
|
|
|
|
|
Visual C++ will recompile any file that it decides is dependent on that file. If you edit a commonly-used header, it will recompile most of the application.
To resolve this, first remove any unnecessary includes from source files - only include those headers actually required. If you're using a precompiled header file (a default VC project uses StdAfx.h as the header file for generating precompiled headers) you should only include in that header headers that are very stable.
In some cases you may have used #include in a header file where the actual definition is not required - i.e. the class declared in the header is only passed or stored as a pointer or as a reference. If this is the case you can remove the #include and only give a forward declaration, e.g.
#include "MyClass.h"
class MyOtherClass
{
public:
MyOtherClass( MyClass* pMyClass );
private:
MyClass* m_pMyClass;
};
class MyClass;
class MyOtherClass
{
public:
MyOtherClass( MyClass* pMyClass );
private:
MyClass* m_pMyClass;
}; If this is still causing too much to be regenerated, you can use a trick called, variously, a compilation firewall, the Cheshire Cat technique, or the Pimpl Idiom[^]. Pimpl stands for Pointer-to-implementation.
Stability. What an interesting concept. -- Chris Maunder
|
|
|
|
|
Thanks guy
I'll take a look about this.
The point then is replace includes by class where possible?
Doc
|
|
|
|
|
doctorpi wrote:
The point then is replace includes by class where possible?
Yes. Here are some hints of what is possible:
<code><font size=2 face="Courier New"><font color="#000080">#include "notpossible.h";
class</font><font color="#008080"> </font>Possible;
<font color="#000080">class</font><font color="#008080"> </font>MyClass
{
<font color="#000080">public</font>:
<font color="#008080"> </font>Possible<font color="#008080"> </font>foo<font color="#008080"> </font>(Possible<font color="#008080"> </font>v,<font color="#008080"> </font><font color="#000080">const</font><font color="#008080"> </font>Possible&<font color="#008080"> </font>r,<font color="#008080"> </font>Possible*<font color="#008080"> </font>p);
<font color="#008080"> </font><font color="#000080">void</font><font color="#008080"> </font>bar()
<font color="#008080"> </font>{
<font color="#008080"> </font>NotPossible<font color="#008080"> </font>n<font color="#008080"> </font>=<font color="#008080"> </font><font color="#000080">3</font>;
<font color="#008080"> </font>}
<font color="#000080">private</font>:
<font color="#008080"> </font>NotPossible<font color="#008080"> </font>nope;
};
</font>
</code>
|
|
|
|
|
Hi
I have already posted this kind of question before this one but didn't get any answer which satisfies me, so again posting it.
I have developed a multithreaded application ( a windows service ), which runs on Windows 2000 Professional.
I have made it using VC++.
My problem is : I want to create 10,000 threads and what to keep all threads running without suspending at all the times. So is there any other way to create such big number of threads and is it feasible to create such a greate many number of threads ? What will be resourece utilization if i create such threads....I think my CPU memory will be used 100% and it will get hanged....is it ?
Any suggestion, any help....plz
Thankx in advance
Regards,
Amarelia Mahesh
Gujarat
India
|
|
|
|
|
You can't do it. Find some other way.
Technical details: threads by default have a 1MB user-mode stack reserve - 1MB of the process's address space is reserved for the thread's stack. They also have a few pages of kernel stack reserved.
A simple bit of arithmetic reveals that if you tried to create 10,000 threads you would need 10GB of address space for user-mode stacks. You only have 2GB of user-mode address space available. Therefore you can't do it.
Large numbers of threads also slow down the system's scheduler code, and increase the amount of memory used for book-keeping. If all the threads are runnable, not blocked waiting for a resource, they will get in each others' way - the system is likely to spend more time in the scheduler than acttually doing useful work.
If you're trying to handle concurrent requests by using one thread per client, switch to a pool of threads.
Stability. What an interesting concept. -- Chris Maunder
|
|
|
|
|