|
Hi there,
I am trying to run an exe, but before running it, I would like to find out whether another exe by the same is running on a system or not.
Would anyone here know how I could find such Process information? I would imagine there is a simple way of doing it as Windows NT comes up with its powerful and useful task manager which provides all kind of process information including the actual Process name.
I would appreciate your response.
thanks
|
|
|
|
|
> I would like to find out whether another exe by the same is running on a system or not.
The ToolHelp library may be able to help. Lookup the ::CreateToolhelp32Snapshot function.
Peace!
-=- James.
|
|
|
|
|
I am writing a paint program, which has the primary function of providing texture editing for a 3D system. I am using CopyData to send the path to an image to my paint program, and to send back a message so the 3D package reloads it. I really would love to learn COM but have had no time, such that all I have done is a simple server that returns a string from a list at random and a dialog that uses this to display a string at random. Not exactly rocket science, but my only experiment in learning some ATL before I got too swamped to continue.
Now I am wondering if it would be possible to build an ATL bitmap 'server', in other words to pass in a HBITMAP, sned a message to the other program ( this would go both ways ) which would tell it to change the image refered to in the message by loading the image held in my server. I believe this should be relatively easy, given my usual misplaced optimism, and I'm hoping you guys (and gals, if applicable) could tell me before hand of any problems or potential disasters awaiting me. I am guessing it would work like the clipboard, ie if I pass in a HBITMAP I lose ownership of it, etc. I actually considered using the clipboard but would prefer not to.
Christian
The content of this post is not necessarily the opinion of my yadda yadda yadda.
To understand recursion, we must first understand recursion.
|
|
|
|
|
Hello. I am novice at Visual c++. I would like to excute my program
when client access to my web page. That is, when client access to my web
page, check if my program is installed on client computer or not,
and then, if is, excute my program, and if is not, excute my program
after install my program on client computer. How can I do this??
Please let me know!! My program is big, occupiable CPU because it
is graphic program. Is it possible to make my program to ActiveX, even
if it is so big?? Please let me know.
Thank you...
LJS
|
|
|
|
|
I can answer the second part - we have a 3D package that is pretty big and we have put it into an ActiveX control, so I doubt that will be a problem.
Christian
The content of this post is not necessarily the opinion of my yadda yadda yadda.
To understand recursion, we must first understand recursion.
|
|
|
|
|
Hi!
My Bitmap-Procedure works now without any problems! Thanks
to those who helped me to fix it!!
But there is still no Bitmap on my screen when I start my ShowMyBitmap procedure.
Here is the code:
P.S:Calling my procedures by a a Button which is in the same window as the Bitmap. Is this the mistake?
P.P.S: Using VC++6
-------------------------
void CLastPicDlg::LoadmyPic()
{
m_sFileName = "pic01.bmp";
HBITMAP hBitmap = (HBITMAP)::LoadImage(AfxGetInstanceHandle(),
m_sFileName, IMAGE_BITMAP, 0, 0,
LR_LOADFROMFILE | LR_CREATEDIBSECTION);
m_bmpBitmap.Attach(hBitmap);
MessageBox("Loading:" + m_sFileName, "Loading File");
}
void CLastPicDlg::ShowmyPic(CPaintDC *clientDC)
{
CDC temp;
temp.CreateCompatibleDC(clientDC);
CBitmap* pOldBitmap = (CBitmap*)temp.SelectObject(m_bmpBitmap);
CRect lRect;
GetClientRect(lRect);
lRect.NormalizeRect();
clientDC->StretchBlt(10, 10, (lRect.Width() - 20), (lRect.Height()- 20), &temp, 320, 200, 0, 0, SRCCOPY);
}
void CLastPicDlg::OnLoadbut()
{
LoadmyPic();
}
void CLastPicDlg::OnShowbut()
{
CPaintDC clientDC(this);
ShowmyPic(&clientDC);
}
|
|
|
|
|
You're trying to flip the bitmap ? If not, why are the co-ordinates of the source bitmap reversed ?
I'd suggest doing this:
BITMAP bm;
m_bmpBitmap.GetBitmap(&bm);
then when you stretchblt you can use bm.bmWidth and bm.bmHeight instead of hard coded values.
I'd also check the hBitmap for NULL to make sure it is OK, and check the BOOL return from StretchBlt in order to narrow down your problem, but I'm a little nervous about your source co-ordinates - change them to 0,0,bm.bmWidth,bm.bmHeight and then experiment. I remember the flipping of images being a little different to what the MSDN saya but I don't recall the details, so I'd get it showing first, then try to flip it. I think you're grabbing 0 pixels across and down starting from 320, 200.
Christian
The content of this post is not necessarily the opinion of my yadda yadda yadda.
To understand recursion, we must first understand recursion.
|
|
|
|
|
Greetings Programs,
I've hit an interesting error when using threads and timers in my latest project. If I execute a new thread from one class calling a function of another class like so:
_beginthread(pPointer->IInitializeMonitor, 0, NULL);
I recieve the following error:
Y:\smtpmon\smtpmon.cpp(364) : error C2664: '_beginthread' : cannot convert parameter 1 from 'void (void)' to 'void (__cdecl *)(void *)'
Similarly, if I call a Timer Callback function from within it's own class, such as:
bSuccess = SetWaitableTimer(
hTimer, // Handle to the timer object.
&liDueTime, // When timer will become signaled.
m_iInterval*1000, // Periodic timer interval of X seconds.
TimerAPCProc, // Completion routine.
NULL,
FALSE ); // Do not restore a suspended system.
I recieve the following error:
Y:\smtpmon\smtpcom.cpp(57) : error C2664: 'SetWaitableTimer' : cannot convert parameter 4 from 'void (void *,unsigned long,unsigned long)' to 'void (__stdcall *)(void *,unsigned long,unsigned long)'
I'm sure that I'm missing something simple, but I just can't figure out what it is. Any help would be greatly appreciated.
Rhoam
|
|
|
|
|
yes, it's simple:
C != C++
you can only use plain C functions (or static C++ member functions) as the callback or thread proc.
-c
------------------------------
Smaller Animals Software, Inc.
http://www.smalleranimals.com
|
|
|
|
|
|
it is somebody ho know more about gantt in vc++?
bogdan
|
|
|
|
|
|
Does anyone have an idea, how can I export a bitmap to an RTF file? Please Help
manos
|
|
|
|
|
hi!
Why doesn't it work?
VC++6 reports that it can't convert the 5th parametre
of StretchBlt
-------------------------------
void CLastPicDlg::LoadmyPic()
{
m_sFileName = "pic01.bmp";
HBITMAP hBitmap = (HBITMAP)::LoadImage(AfxGetInstanceHandle(),
m_sFileName, IMAGE_BITMAP, 0, 0,
LR_LOADFROMFILE | LR_CREATEDIBSECTION);
m_bmpBitmap.Attach(hBitmap);
}
void CLastPicDlg::ShowmyPic(CPaintDC *clientDC)
{
CDC temp;
temp.CreateCompatibleDC(clientDC);
temp.SelectObject(m_bmpBitmap);
CRect lRect;
GetClientRect(lRect);
lRect.NormalizeRect();
clientDC->StretchBlt(10, 10, (lRect.Width() - 20), (lRect.Height()- 20), temp, 0, 0, 320, 200, SRCCOPY);
}
|
|
|
|
|
You are getting this error because the StretchBlt is expecting a pointer to the temporary DC, this will work:
clientDC->StretchBlt(10, 10, (lRect.Width() - 20), (lRect.Height()- 20), &temp, 0, 0, 320, 200, SRCCOPY
|
|
|
|
|
StretcBlt takes a CDC Pointer. Try this:
clientDC->StretchBlt(10, 10, (lRect.Width() - 20), (lRect.Height()- 20), &temp, 0, 0, 320, 200, SRCCOPY);
|
|
|
|
|
|
I need to make a software which partitions hard disk efficiently. I need to know if WinAPIs are available for the purpose.
Ammar
|
|
|
|
|
I want all my mdi childframes to be maximized so the view fills the window like an SDI app, how do I make the childwindow maximized, how do I make it non-user sizeable afterwards and how do I remove min/max buttons from the app menubar?
thanx in advance.
|
|
|
|
|
If you want to make your frame window non-sizeable and remove max button do it like this
in your PreCreateWindow function of child frame add these two lines
BOOL CMyFrame::PreCreateWindow(CREATESTRUCT& cs)
{
//These are the two lines
cs.style = cs.style & ~ WS_THICKFRAME; //remove resizing
cs.style = cs.style & ~ WS_MAXIMIZEBOX;//remove max button
if( !CMDIChildWnd::PreCreateWindow(cs) )
return FALSE;
return TRUE;
}
Unfortunately I do not know how to make it fill the window
Hope this helps,
Orcun Colak
http://www.geocities.com/ton_soft
|
|
|
|
|
Hi;
My first post... silly and simple questions, but i've poured through MS Disaster Network (MSDN) and
Wrox "Professional MFC 6.0", and can't find answers to easy questions. I've done these in the past, but it's been so long that i've forgotten how.
First, how in the blink do you add a custom app icon (upper left corner icon)? I modified the stock Wizard supplied icon (the building blocks one) and yet, the app doesn't use it! It's in the project and the IDR_MAINFRAME rc is pointing at the correct file but... argh!
Secondly, I need to intercept both the minimize button on the right of the title bar and also the minimise menu item on the system menu so that when the user clicks on those, I can minimize to the tray instead of the task bar - client requirement (and i'd like to know how to do it myself!). I already have a menu item for minimize to tray (on the view menu), but need it this way too.
TIA!
Dave LeBlanc
|
|
|
|
|
For custom Icon, in your dialog constructor, add
// Note that LoadIcon does not require a subsequent DestroyIcon in Win32
m_hIcon = AfxGetApp()->LoadIcon(IDI_MYICON);
There may be other ways but this is what the wizard gives me and it works when I am using MFC.
Have Fun!
|
|
|
|
|
G'day Dave,
Re: The icon problem. Have you edited the 32x32 pixel icon and forgotten to do the 16x16 version? Been there, done that...
There's a drop list just above the icon editing window to let you select the size of icon to work on.
Sorry, I cant help with the minimizing problem, but there's a CP article here that might set you straight.
Hope this helps.
Steve
|
|
|
|
|
Take a loot at this article:
http://www.codeproject.com/gdi/replaceicon.asp
Enjoy!
|
|
|
|
|
You need a handler for WM_SYSCOMMAND message. Maybe something like this:
void CMainFrame::OnSysCommand(UINT nID, LPARAM lParam)
{
CFrameWnd::OnSysCommand(nID, lParam);
if (nID == SC_MINIMIZE)
{
}
}
Don't forget to add ON_WM_SYSCOMMAND() to the message map .
HTH, peter
|
|
|
|
|