|
|
Dear friends,
I am a semi-beginner in VC++ and I use MFC for writing a Robot control based application, Although I am a beginner Windows Programmer but It's been several years that I program in C.
I have a dialog based MFC application and I want to have another window without focus(modal) beside it which i can draw some graphics in(updated by some inervals by main dialog routines). If someone please give me some keywords to search and some howtos for this subject I would really appreciate it. in simple words:
1. I wanna open a new dialog from the main dialog.(I know how to do it , but I don't know how to make it in-modal)
2. I wanna draw some graphics on the new dialog.(If somebody please refer me a good article to start simple graphics in MFC , I would really appreciate it)
3.I wanna update some graphics on the window , time by time.
Thanx a lot.
PS. I am so sticky to a subject , Just show me the way and I will go beyond it to the end.
Mani Monajjemi
www.manionline.org
|
|
|
|
|
1) I don't know exactly what you are looking for. A modeless dialog or a modal dialog ? A modeless dialog is a dialog that lets the 'parent' dialog still reacts to events (and doesn't block the main 'loop'). A modal dialog is a dialog that will receive all the focus (the user won't be able to interract with the parent window anymore) and will block also the main 'program flow' (the program will block until the dialog closes). There is a good article here on CP about modeless dialogs.
2) What kind of graphics do you want to do exactly ? You can perhaps find an existing control that does what you want. Othrewise, it can be a little bit confusing to start from scratch (but still feasible, depends also of the complexity of what you want to achieve)
3) That's easy, you can simply use a timer (you'll find documentation in MSDN and it is easy to use).
Provide perhaps more information in order for us to help.
|
|
|
|
|
Hi,
could some one help me here!!
i want to acces to the bits of my Bitmap Picture but i dont know how?
i made those:
CBitmap m_bmpBitmap;
HBITMAP hBitmap // handler.
So!!
Thank you Verry Much
|
|
|
|
|
GetDIBits will give you a DIB. then use a bit of pointer arithmetic (and a whole lot of accounting for different bit depths) to get at the actual pixels.
Cleek | Image Toolkits | Thumbnail maker
|
|
|
|
|
|
I'm using the library "psapi.h" but there's an error ([Linker Error] Undefined Reference to 'EnumProcesses@12'). Someone told me I must link to psapi.lib. How can I do it??? (in one of these IDE's: Borland C++6 , Visual C++ 2005 or Dev-C++)
Thiago
|
|
|
|
|
#pragma comment( lib, "psapi")
"What classes are you using ? You shouldn't call stuff if you have no idea what it does" Christian Graus in the C# forum
led mike
|
|
|
|
|
The pragma did'nt work but here is the code:
#include <cstdlib>
#include <windows.h>
#include <tlhelp32.h>
#include <psapi.h>
#include <iostream>
#pragma comment( lib, "psapi")
using namespace std;
int main(int argc, char *argv[])
{
DWORD* t;
DWORD* returned;
DWORD tam= 40;
bool temp = EnumProcesses(t,tam,returned);
cout<<"Numero de Processos na memória: "<< *returned/sizeof(DWORD);
system("PAUSE");
return EXIT_SUCCESS;
}
Thiagooo
|
|
|
|
|
ThiagoFragoso wrote: The pragma did'nt work
Ambiguous Clarify with a professional and specific statement.
"What classes are you using ? You shouldn't call stuff if you have no idea what it does" Christian Graus in the C# forum
led mike
|
|
|
|
|
ThiagoFragoso wrote: DWORD* t;
DWORD* returned;
DWORD tam= 40;
bool temp = EnumProcesses(t,tam,returned);
Unless you have allocated sufficient memory for t and returned , your code will not work. Use:
DWORD t[150];
DWORD returned;
BOOL temp = EnumProcesses(&t,tam,&returned);
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
"We will be known forever by the tracks we leave." - Native American Proverb
|
|
|
|
|
You might want to drop the & on the first parameter.
|
|
|
|
|
In VC2k5 you can write this code:
#pragma comment (lib, "psapi.lib")
on the header of your project (however this can be everywhere I always put it in header of main file of project)
OR (two way)
you click "Project/Project_name properties" on menu and there is "Configuraction Properties/Linker/Input" and you add this library ("psapi.lib") in "Additional Dependencies" and you can build the project
hmm but I don't know how do it in BC++ or DevC++
-----------------------------------------------------------------
Surely without war there would be no loss
Hence no mourning, no grief, no pain, no misery
No sleepless nights missing the dead... Oh, no more
No more war
[Sleepless - Cradle of Filth]
|
|
|
|
|
Thanks a lot. This solution worked for Borland C++
|
|
|
|
|
Hi,
I create a service with the following instruction:
newService = CreateService(
scm, //scm database
ServiceName, //service name
ServiceName, //display name
SERVICE_ALL_ACCESS, //access rights to the service
//SERVICE_WIN32_OWN_PROCESS, //service type first attempt
SERVICE_WIN32_OWN_PROCESS | SERVICE_INTERACTIVE_PROCESS, //second attempt
SERVICE_AUTO_START, //service start type
SERVICE_ERROR_NORMAL, //error control type
szBuffer, //service path
NULL, //no load ordering group
NULL, //no tag identifier
NULL, //no dependencies
NULL, //LocalSystem account
NULL); //no password
and inside the thread I call the GetForegroundWindow() but the result is... NULL!!!
What can I do please?
Thank you anywhere.
Alksindrs
|
|
|
|
|
Alksindrs wrote: NULL, //LocalSystem account
That account has no Desktop and therefore no windows.
"What classes are you using ? You shouldn't call stuff if you have no idea what it does" Christian Graus in the C# forum
led mike
|
|
|
|
|
ok led mike, I saw my error,
so how can I get the foreground Window with a thread if I don't now the password of the account? (not mine, of course)
|
|
|
|
|
Well I have no idea what your overall objective is but to see what is possible and how from a Windows Service you might start here[^]
"What classes are you using ? You shouldn't call stuff if you have no idea what it does" Christian Graus in the C# forum
led mike
|
|
|
|
|
Hi Ppl,
On installing projects/packages on XP I get this error mssg missing mfc7xxxxx.dll (where x varies)
Where can I get an installable copy of these runtime, or the component dll files,
for XP?
Tnx
|
|
|
|
|
See here. While it is specific to MFC v4.2, it may help to point you in the right direction.
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
"We will be known forever by the tracks we leave." - Native American Proverb
|
|
|
|
|
Paps2 wrote: Where can I get an installable copy of these runtime, or the component dll files, for XP?
why not try building software package with InstallShield or InnoSetup... they themselves give you the list of dll to choose from
"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
|
|
|
|
|
Hi Geniuses,
I saving the toolbar status of my MDI application using SaveBarState (_T("TBStatus")). It works fine. It stores the status in the registry here:
HKEY_CURRENT_USER\Software\Local AppWizard-Generated Applications\MyApp\TBStatus
I the status to be stored in some other place, specifically here:
HKEY_LOCAL_MACHINE\SOFTWARE\MyApplication\TBStatus
Where "HKEY_LOCAL_MACHINE\SOFTWARE\MyApplication" is the installation entry.
My aim is to remove the toolbar status entry from the registry while uninstalling the application.
If anybody could suggest me a solution, I would be grateful.
Thanks in advance,
Sarvan AL
|
|
|
|
|
Sarvan AL wrote: My aim is to remove the toolbar status entry from the registry while uninstalling the application.
Ok, so just use RegDeleteValue() and RegDeleteKey() .
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
"We will be known forever by the tracks we leave." - Native American Proverb
|
|
|
|
|
I have been trying to make a simple keyboard that can send keys pressed to another application. I want it like what multi language OS does in that I enter it in one application(keyboard) and it will "inject" the key message to another application's message buffer. Can any one direct me in the right direction or the right API to use etc?
Thanks in advance.
|
|
|
|
|
Stan the man wrote: I want it like what multi language OS does in that I enter it in one application(keyboard) and it will "inject" the key message to another application's message buffer.
I don't really understand the part in which you are speaking about "multi language OS", can you be more explicit please ?
Otherwise, if you are working on windows, you can take a look at the PostMessage[^] function. But first you'll have to retrieve the HANDLE of the window (other guys here will be more helpfull than me on this point).
|
|
|
|