|
hi,
if you want to communicate between two application you need the Window Handle for the window that should hanld the message you want.
you can retreive the desired window handle by usinf EnumWindows this API will enumerate all the running applications; to indicate the desired application you can use GetWindowText API to retreive the Application main window title and compare it with application title you want to communicate with, after gaining the handle you can use SendMessage or PostMessage to send that application the Message you like.
Good Luck...
Mohammad Zakarni;)
|
|
|
|
|
hi,
I am setting windows message hook to an application like notepad. I am using create process of notepad in some client. In same client I am loading DLL having the hook routines. Passing threadID of notepad to funcion present in DLL setting the hook. but in hooking it says that can not install non local hook . what should I do?
VIKS
|
|
|
|
|
no short answer on this...check out codeguru, article called "API Hooking Reveale" by Ivo Ivanov....there may be inof on this site, not sure, but I no Ivo's has your answers for you, be prepared for some heavy reading
1. The Lord loves a workin' man.
2. See a doctor and get rid of it.
3. Don't trust whitey.
|
|
|
|
|
Can anybody tell me the class and function through which I can find out if the file is empty or not.
Thanks in advance
Samir Sood
|
|
|
|
|
|
Hi.
In both windows and dialog boxes, there are buttons on the upper right corner of the frame to minimize, maximize, and/or close window. Is it possible to enable or disable one or more of those buttons? For example, I would like to disable the maximize option during a certain time and then reenable it.
Thanks,
Kuphryn
|
|
|
|
|
|
Nice! Thanks.
How about the close window, big "X" icon? Is there a way to disable it too and/or catches it because the program closes or the dialog closes?
Kuphryn
|
|
|
|
|
hi,
hm....sorry cound find how to disable the "X" button, but it think you can catch, whether the dialog closes or not. Put the WM_CLOSE handler to your Dialog class and put the code in that you need. This will always tell you when the dialog is closing!
for example:
void CCloseDDlg::OnClose()
{
MessageBox("Closing the app");
CDialog::OnClose();
}
Regards, Sonu
|
|
|
|
|
Thanks.
Perfect! That solution is exactly what I will implement if it is not possible t disable the "X" in the window frame and/or dialog box frame.
Kuphryn
|
|
|
|
|
Hello
As Sonu has said you can override OnClose(), but if you actually want to disable the close button, use this code
GetSystemMenu(FALSE)->RemoveMenu(SC_CLOSE,MF_BYCOMMAND);
Author of the romantic comedy
Summer Love and Some more Cricket [New Win]
|
|
|
|
|
Nice!!! Thanks!
I tried our solution. I was able to disable the "X," but could not recover it. Through looking up some other functions via help, I found another solution.
-----
// Disable the "X"
GetSystemMenu(FALSE)->EnableMenuItem(SC_CLOSE,MF_DISABLED);
// Enable the "X"
GetSystemMenu(FALSE)->EnableMenuItem(SC_CLOSE,MF_ENABLED);
-----
Furthermore, SC_CLOSE is just one of a series of menu items that can be used.
GetSystemMenu() is very powerful. Thanks!
Kuphryn
|
|
|
|
|
I've been using the ::GetDIBits function to convert from HBitmap to DIB in a thumbnailer I'm writing. The idea is to use GetDIBits to convert from any bitmap format to a 32 bpp DIB. I then render the DIB to the screen with ::StrechDiBits.
The code below works fine with W98/WMe but under W2k/XP it sometimes - very often - render transparent bitmaps. I wonder if this a bug from me or a bug from the driver of my video card (ATI Radeon DDR 64), but I got the same problem on another XP machine.
Can anybody tell me if there's something wrong in the code below ? Personnaly I give up, I tried so many things I've no more idea.
1/ We get a HBitmap from Disk
2/ Prepare for our final DIB header (pBMI)
3/ Get bitmaps bits (GetDiBits)
4/ Save the bits in a buffer from our Image class (m_pBits)
void __fastcall CP3dOBmp::CreateFromHBitmap(HBITMAP hBitmap, int Width, int Height)
{
HANDLE hDib;
BITMAPINFO* pBMI;
HDC hDC = ::GetDC(NULL);
// Get bitmap format
//::GetDIBits(hDC, hBitmap, 0, 0, NULL, pBMI, DIB_RGB_COLORS);
Create(Width, Height, 32);
int nMem = sizeof(BITMAPINFOHEADER) +
(((((Width * 32) + 31) & ~31) >> 3) * Height);
hDib = GlobalAlloc(GHND, nMem);
if (!hDib) return;
pBMI = (BITMAPINFO *)GlobalLock(hDib);
BITMAPINFOHEADER* pBIH = (BITMAPINFOHEADER *)pBMI;
pBIH->biSize = sizeof(BITMAPINFOHEADER);
pBIH->biWidth = Width;
pBIH->biHeight = Height;
pBIH->biPlanes = 1;
pBIH->biBitCount = 32;
pBIH->biCompression = BI_RGB;
pBIH->biSizeImage = ((((Width * 32) + 31) & ~31) >> 3) * Height;
pBIH->biXPelsPerMeter = 0;
pBIH->biYPelsPerMeter = 0;
pBIH->biClrUsed = 0;
pBIH->biClrImportant = 0;
// Get hBitmap data
if (::GetDIBits(hDC, hBitmap, 0, Height,
(LPBYTE)pBMI->bmiColors, // Pointer to the bits
pBMI,
DIB_RGB_COLORS)) {
memcpy(m_pBits, (LPBYTE)pBMI->bmiColors, (32/8)*Width*Height);
}
GlobalUnlock(hDib);
GlobalFree(hDib);
::ReleaseDC(NULL, hDC);
}
The GetDiBits function obviously returns a blank buffer as I don't initialize the m_pBits one and I get a transaprent bitmap.
Good luck )
Yarp
|
|
|
|
|
Try using a BITMAPV4HEADER instead of a BITMAPINFOHEADER. I had the reverse problem. I had code working under XP, but failed under 95/98. If nothing else it's worth a shot.
Joel Lucsy (jjlucsy@ameritech.net)
|
|
|
|
|
I can try this, I tried nearly hundrer solutions this weekend.
I think the problem comes from a memory management difference between XP and W98. I should probably lock something somewhere.
I'll tell you here, if I got the fix.
Yarp
|
|
|
|
|
I found - at last - that the reason why it doesn't work is that the bitmap (HBITMAP) must not be selected in a device context before to proceed. Otherwise the code is good.
I tried with a BITMAPV4HEADER but I couldn't find the way to call GetDiBits properly and gave up, so I don't know if it would have solve the problem but I guess not.
Tonight I am happy
Cheers,
Yarp
|
|
|
|
|
The idea is to use GetDIBits to convert from any bitmap format to a 32 bpp DIB.
That seems like a very slow way of creating a 32-bpp DIB compared to using CreateDibSection() and just blitting the source to the created bitmap. Just call GetObject to get the bits later on.
|
|
|
|
|
This seem a better solution, thank for the GetObject suggestion I had no idea of another way to proceed.
Unfortunately Microsoft Q195830 states that "Blitting Between DCs for Different Devices Is Unsupported (Q195830)" under XP, so I'm affraid this method is not safe enough.
Read more at http://support.microsoft.com/default.aspx?scid=kb;EN-US;q195830
I think my problem comes from memory management.
Thank for the reply, I spent my whole weekend trying to fix the bug ;(
Yarp
|
|
|
|
|
I'm using some property pages in a program, the property sheet for some reason has a "help" button on it, I tried to remove it by:
sheet.m_psh.dwFlags &= ~PSP_HASHELP;
But it still won't go, how can I get rid of it? Thanks.
BTW, I think by default the help button should not be there, right?
|
|
|
|
|
|
Cool it worked. Thank you.
|
|
|
|
|
I am trying to get a string of a MFC status-bar (original class name msctls_statusbar32) from another application (which means I access it using hwnd manipulations).. MFC obviously subclassed something there because when I do:
char Text2[1024];
int X = SendMessage(StatusBar, SB_GETTEXT, 0, (LPARAM)Text2);
*StatusBar - The MFC status-bar hwnd.*
I get in X the length as I should (25 in my case), but Text2's value is left unchanged =(.
Do you know how can I get another's application MFCs status-bar text??
Vitaly Belman
|
|
|
|
|
Does anyone know how I could use the script control to read/write to a serial comm port. A friend of mine showed me an application that does this. Inside of the script file it has commands like:
sc.read(&H1)
sc.write("42 04 3F")
Of course, I do not have the source code for this since it is not mine. But, it works slick. The readme file for the app says something that downloading the script control may be necessary for your operating system if you are getting errors so I know it uses it.
|
|
|
|
|
I don't know in what forum to ask this, but since my programs are written in VC++, I will try it here.
I've got two straigt forward questions on how to use Terminal Service and what can be done.
1. Can I write an applikation that the user launches on the server that starts a new terminal server client on the users client?
2. Can I switch logged on user while i'm inside a terminal server session?
If you know any really good site for learning TS programming, please let me know!
Not completely new to MsTsc but almost
|
|
|
|
|
Hello,
I've created a toolbar with 3 toolbar images for normal, hot and
disabled states. I load the image and create the toolbar under the Rebar
without using the resource editor. I noticed that when an adjacent band
covers part of a toolbar button the chevron's drop-down menu show up but not
include the toolbar image. Also, the drop down menu is missing in the menu
for buttons that have BTNS_WHOLEDROPDOWN or BTNS_DROPDOWN style. How do I
fix those? Thanks!
Hiu Sing Ngai
|
|
|
|