|
Hi all. I am seen a lot of different sample on the internet and they uses the "::", "." and "->" operators differently even in the same situation. For example, some of them use
ServiceAccount.LocalSystem, and when I compile mine under VC.Net 2003, i must use ServiceAccount::LocalSystem to refer to the Account Type. Can anyone tell me why is it?
|
|
|
|
|
|
In C++, :: refers to a static or namespace member, . refers to a member of a variable and -> refers to a member of a pointer. In C#, it's . all the way.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
HI,
below is a piece of code.
HWND hVWnd;
RECT rRect;
GetWindowRect(hVWnd,&rRect); //I have checked that it returns non zero value
diff_val = rRect.bottom-rRect.top;
If on starting a application if my window is minimized then value of rRect.top and
rRect.bottom is -32000.
Is it a garbage value or any valid error code?
Once my window get normal size it gives me a valid wondow cordinates. (such as 405, 395 ..)
my question is,
when a window is minimize then GetwindowRect's top propery is always -32000.
or it could be any other garbage value.
Waiting for your reply
Many thanks
dipak mistry
|
|
|
|
|
You got your answer here[^] didn't you?
Just use ::IsIconic(..) to determine if a window is minimized. If not, get the client rect.
Geert
Want to spread the newest version of your software automatically for free? Use Updater!
Visit my website: www.gvhsoftware.org
|
|
|
|
|
Thank u very much for quick reply
|
|
|
|
|
I had noticed that the values ALWAYS seem to be the -32000 if it is minimized into the taskbar. I was using GetWindowPlacement, and I don't do that if the window IsIconic any more.
|
|
|
|
|
|
if it is a dll, use regsvr32
Geert
Want to spread the newest version of your software automatically for free? Use Updater!
Visit my website: www.gvhsoftware.org
|
|
|
|
|
that is only good for installing in proc COM servers, not device drivers.
Nunc est bibendum!
|
|
|
|
|
Setupdi functions.
Nunc est bibendum!
|
|
|
|
|
hi,
using my program, i want to start an application, let's say internet explorer, or outlook. afterwards i want to set the focus to this application, move it, and maximize it. i need some help, and here are my questions:
1. to start the program i have tried this function, but it crashes.
_wexeclp((wchar_t*)("C:/Program Files/Internet Explorer/iexplore.exe"),NULL);
It says the arguement list cannot be NULL, but i do not know what to put there as argument.
how can run another application?
2. what function can i use to get the path of the program files "C:\program files"? There is a function called "GetWindowsDirectory", but could not find one for program files.
3. after running the application, i am thinking of capturing it with a hook to set the focus on it, to move and change the size of it. is it right? is there a simpler solution? it won't not only internet explorer that needs to be started. i might need to start another program on some other user event.
Thanks in advance
caykahve
|
|
|
|
|
1. Check out the ShellExecuteEx() function
2.
SHGetSpecialFolderPath(NULL, sTemp.GetBuffer(_MAX_PATH), CSIDL_PROGRAM_FILES, FALSE);
3. See 1
Geert
Want to spread the newest version of your software automatically for free? Use Updater!
Visit my website: www.gvhsoftware.org
|
|
|
|
|
Thanks a lot. I can get the program files folder path, and can run other processes using ShellExecuteEx now.
I can get the process handle as HANDLE, but how can I get the CWnd * of the windows that I open? I want to use SetWindowPos() function, therefore i need it.
Thanks,
Caykahve
|
|
|
|
|
I wrote a similar program that the majority of its funcitonality is starting other programs and controlling where on the screen they are placed.
1. To start the other program I actually open up a batch file (.bat You can also use the .cmd extension now, too.) I write in a few lines to the batch file such as: cd "C:\Program Files" That line would change the directory to "Program Files". You can put in the path name of whatever program you want to start. And then: iexplore "http:\\www.google.com" That line would start internet explorer and bring it to the google page.
3. I use a function called EnumWindows(). This function will enumerate all the open windows on the machine. Look at MSDN for this, but you will have to write your own function to tell it what to DO with each window it checks, but in that function you can do something like EnumWindowsMine(HWND hWnd, LPARAM fail) and then use functions like GetWindowText() or GetClassName(). These also you can look up on MSDN. In this way, you can use either the class name of a window or the text of a window to check to see if this window is the one you want to target.
And then you can use MoveWindow() (look this up) to put the window where you want it to. (I had to use ::, like ::MoveWindow(). You may have to, too.) If you want, you could put some of these statements into a loop, so it will loop until the program starts and it is put to where you want it. If you need to, you can use GetWindowRect() to see if the window you are checking is already in the right place. Many places you can go from here.
Hope this helps.
Yesterday is history,
Tomorrow is a mystery,
Today is a gift,
That's why they call it the Present.
Danny
|
|
|
|
|
caykahve wrote:
1. to start the program i have tried this function, but it crashes
You want to use "CreateProcess", to start another program.
caykahve wrote:
2. what function can i use to get the path of the program files "C:\program files"? There is a function called "GetWindowsDirectory", but could not find one for program files.
Why do you need a function to find "C:\Program Files"? Program files is on the C:\ drive, according to what you are asking. It is, however possible to have program files on different drives. If it's that you want to know where the program is running from, well then you can use GetModuleFileName.
caykahve wrote:
3. after running the application, i am thinking of capturing it with a hook to set the focus on it, to move and change the size of it. is it right? is there a simpler solution? it won't not only internet explorer that needs to be started. i might need to start another program on some other user event.
Also since you started the program with create process you now have a handle to it. So you can call SetWindowPos to set the window were ever you want.
Tom Wright
tawright915@yahoo.com
|
|
|
|
|
Hi Friends
I want to get the screen height and widht at run time, so that I can maximize my form size.
Is there any function or any idea how to get screen width and scree height at given resolution ?
Regards,
Amarelia Maehsh
Gujarat
India
|
|
|
|
|
Use GetSystemMetrics() .
"One must learn from the bite of the fire to leave it alone." - Native American Proverb
|
|
|
|
|
You can also use ::GetDesktopWindow() to get the handle of the desktop and then ::GetWindowRect() to get the size of the desktop.
Danny
|
|
|
|
|
If you want the width and height of the desktop, use
CRect rectDesktop;<br />
<br />
SystemParametersInfo(SPI_GETWORKAREA, 0, &rectDesktop, 0);
This gets you the usable area (excluding the taskbar)
|
|
|
|
|
Amarelia wrote:
I want to get the screen height and width at run time, so that I can maximize my form size.
You don't need to know the dimensions of the desktop in order to maximize your main window. Just post it a WM_SYSCOMMAND message with a wParam of SC_MAXIMIZE .
/ravi
My new year's resolution: 2048 x 1536
Home | Music | Articles | Freeware | Trips
ravib(at)ravib(dot)com
|
|
|
|
|
Amarelia wrote:
I want to get the screen height and widht at run time, so that I can maximize my form size.
In Continuation With Mr Ravi,
You can also use Api ShowWindow(SW_MAXIMIZE) ;
Amarelia wrote:
Is there any function or any idea how to get screen width and scree height at given resolution ?
In Continuation With All Above Reply:-
CRect lpRect;
GetWindowRect(::GetDesktopWindow(),&lpRect);
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
|
|
|
|
|
I work in a project with 4 other people. We use Visual C++ DevStudio 6.0 and SourceSafe. I have a question about resource files.
If I edit a dialog in the resource editor, and check it in, MSDev changes the font line in the resource to say
FONT 8, "MS Sans Serif" .
But if someone else changes it and checks it in, MSDev changes it to say
FONT 8, "MS Sans Serif", 0, 0, 0x1 .
Does anyone know what this ", 0, 0, 0x1" thing is all about? Is it something I can turn off, because with a large number of dialogs in the same resource file, doing a diff is quite laborious.
Here is an example of a dialog, before and after:
<br />
IDD_OPTIONS_EDITOR DIALOGEX 0, 0, 307, 255<br />
STYLE DS_MODALFRAME | DS_CONTEXTHELP | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU<br />
EXSTYLE WS_EX_CONTEXTHELP | WS_EX_APPWINDOW<br />
CAPTION "Editor"<br />
FONT 8, "MS Sans Serif"<br />
BEGIN<br />
...<br />
<br />
IDD_OPTIONS_EDITOR DIALOGEX 0, 0, 307, 255<br />
STYLE DS_MODALFRAME | DS_CONTEXTHELP | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU<br />
EXSTYLE WS_EX_CONTEXTHELP | WS_EX_APPWINDOW<br />
CAPTION "Editor"<br />
FONT 8, "MS Sans Serif", 0, 0, 0x1<br />
BEGIN<br />
...<br />
Thanks
d3m0n
|
|
|
|
|
[d3m0n] wrote:
FONT 8, "MS Sans Serif", 0, 0, 0x1.
The format is:
FONT pointsize, typeface, weight, italic, charset
"One must learn from the bite of the fire to leave it alone." - Native American Proverb
|
|
|
|
|
DavidCrow wrote:
The format is:
FONT pointsize, typeface, weight, italic, charset
David
Thanks for that, but please tell me where you found this information so I can find out why it keeps changing.
I tested it some more and it looks like whenever I modify a dialog, MSDev seems to scan the entire .rc file and adds the ", 0, 0, 0x1" string on some dialogs, and removes the string from others. Regardless of whether I modified (or even opened) those dialogs.
Maybe I should write a small exe to rip out all the ", 0, 0, 0x1" strings, and run that before every checkin. Seems like overkill though...
HELP!
Cheers
d3m0n
|
|
|
|
|