|
Thanks Maximilien,
Any ideas to my original question?
regards,
George
|
|
|
|
|
Hi VuNic,
I use STL, COM and ATL, and I am also learning C#. Any ideas to my original question?
regards,
George
|
|
|
|
|
Hello everyone,
Once I thought all calls across COM apartments (not inside apartment) are all synchronous call, now after study re-entrancy problem, I think I am wrong, at least STA to MTA call is asynchronous.
(Link to re-entrancy problem, http://www.codeproject.com/KB/COM/sta_issues.aspx)
After some study, I can not find a conclusion whether the 4 types of calls are synchronous or asynchronous. Here is my study result, please feel free to correct me if I am wrong?
1. STA --> STA, I think asynchronous;
2. STA --> MTA, I think asynchronous;
3. MTA --> STA, I think synchronous;
4. MTA --> MTA, I think synchronous.
thanks in advance,
George
|
|
|
|
|
Hi all,
In SDI type of application how can show application in Maximize mode and Fix it.
i m using this "ShowWindow(SW_MAXIMIZE);" in .cpp file of application,but it is not working properly.
it show application in maximize but restore also.
please anyone help me for this.
Thanks in advance.
|
|
|
|
|
Hi,
Is this solve the problem?
<br />
m_pMainWnd->ShowWindow(SW_SHOWMAXIMIZED);<br />
m_pMainWnd->UpdateWindow();<br />
Thanks
--
"Programming is an art that fights back!"
|
|
|
|
|
no is not solved out my problem because use of this widow open as maximize but restore also.
|
|
|
|
|
rp_suman wrote: m_pMainWnd->ShowWindow(SW_SHOWMAXIMIZED);
m_pMainWnd->UpdateWindow();
hi i m already try this but it is not working.
it is only initially maximize the window, and restore too.
but i want window should be maximize all the time and it not restore.
thanks.
|
|
|
|
|
|
In my simple win32 pgm I launch Notepad,
CreateProcess("c:\\winnt\\notepad.exe"...
then get a handle to it,
hwndTarget = FindWindow(NULL, TEXT("Untitled - Notepad"));
then close it with no problem,
SendMessage(hwndTarget, WM_CLOSE, 0, 0);
But if instead of closing it I try to Post/Send it a character to display
PostMessage (hwndTarget, WM_CHAR, 'x', 1) ;
SendMessage (hwndTarget, WM_CHAR, 'z', 1) ;
it doesn't work.
So I'm missing something here, but don't know what it is.
Thanks for any assistance!
glyfyx
|
|
|
|
|
The problem is that you're sending the messages to the main window.
Maybe the edit control that processes the chars is a child window of the main. You can find it with spy++.
Hope it helps
rotter
The metaller programmer
|
|
|
|
|
Thanks rotter - I believe that's it!
I used Spy++ (for the first time!) and found what looks very much like a child window and its handle under Notepad. Now what I have to do is figure out how to obtain the child's handle in my code then send WH_CHAR to it.
Big help - thanks!
glyfyx
|
|
|
|
|
I'm writing a custom PE loader, and I finished everything except relocations, which I can't find anywhere in the EXE. I'm using Windows's notepad.exe as my initial test. Both the BASERELOC directory entry (DataDirectory[5]) and the PointerToRelocations field of the .text section are set to all 0's. Also, there is no ".reloc" section. Any ideas where these relocations would be located?
|
|
|
|
|
Anyone? A possibility is that modern compilers assume the base image address will never change, and forego creating relocations. Can anyone confirm or deny this?
|
|
|
|
|
This program will list all the addresses in "Kernel32.dll" that would need relocating if it didn't load at its preferred base address:
#include "stdafx.h"
#include <iostream>
#include <windows.h>
using namespace std;
int main(int argc, char* argv[])
{
char *pBase = (char*)GetModuleHandle("kernel32.dll");
PIMAGE_DOS_HEADER pDOS = (PIMAGE_DOS_HEADER)pBase;
assert(pDOS->e_magic == IMAGE_DOS_SIGNATURE);
PIMAGE_NT_HEADERS pNT = (PIMAGE_NT_HEADERS)(pBase + pDOS->e_lfanew);
assert(pNT->Signature == IMAGE_NT_SIGNATURE);
PIMAGE_OPTIONAL_HEADER pOpt = &(IMAGE_OPTIONAL_HEADER)(pNT->OptionalHeader);
assert(pOpt->Magic == IMAGE_NT_OPTIONAL_HDR32_MAGIC);
PIMAGE_DATA_DIRECTORY pRelocDD = &(pOpt->DataDirectory[IMAGE_DIRECTORY_ENTRY_BASERELOC]);
DWORD SizeOfRelocs = pRelocDD->Size;
PIMAGE_BASE_RELOCATION pReloc = (PIMAGE_BASE_RELOCATION)(pBase + pRelocDD->VirtualAddress);
for (DWORD ToGo = SizeOfRelocs; ToGo>0; )
{
WORD *pRelocArray = (WORD*)(pReloc + 1);
DWORD NumRelocs = (pReloc->SizeOfBlock - sizeof(IMAGE_BASE_RELOCATION)) / sizeof(WORD);
for (DWORD i=0; i<NumRelocs; ++i)
{
WORD val = pRelocArray[i];
WORD Type = val >> 12;
WORD RVA = val & 0x0FFF;
cout << hex << "Type = " << Type << ", Address = " << (DWORD)(pBase + pReloc->VirtualAddress + RVA) << endl;
}
ToGo -= pReloc->SizeOfBlock;
pReloc = (PIMAGE_BASE_RELOCATION)((char*)pReloc + pReloc->SizeOfBlock);
}
return 0;
}
See here[^] for for information.
Steve
|
|
|
|
|
Hi friends,
I am working on a chat-like application. I was thinking of adding a added utility to it. I want the program to copy itself on another PC of the network & execute there ....
PLz help me in this ....
Thanx !
|
|
|
|
|
Google for RPC.
"Love people and use things, not love things and use people." - Unknown
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
|
or trojan.
OK,. what country just started work for the day ? The ASP.NET forum is flooded with retarded questions. -Christian Graus
Best wishes to Rexx[^]
|
|
|
|
|
|
Hi all,
I need to paint the background of a CStatic control created dynamically this way:
CUnknownCtrl* pUnknown;
pUnknown = new CUnknownCtrl;
pUnknown->Create("Text", SS_CENTER | WS_CHILD | WS_VISIBLE | WS_GROUP, CRect(11,35,360,526), this, 0x31);
Notice that CUnknownCtrl is a CStatic-derived mfc class.
I can't figure out how to set background color of the label created with this code, someone can help me?
Calling OnCtlColor inside CUnknownCtrl won't even be executed and OnPaint fails. Some idea?
Thanks for advance
---
|
|
|
|
|
Hi,
Simply handle the WM_CTLCOLORSTATIC message in your class. The WM_CTLCOLORSTATIC is send to a static control when its background color need to drawn.
thanks.
Nitheesh
|
|
|
|
|
WM_CTLCOLORSTATIC is sent to the parent window of the static control, not the static control itself.
|
|
|
|
|
4288 wrote: and OnPaint fails
What does that mean?
led mike
|
|
|
|
|
I used OnCtlColor handler, but because my label was created with a CStatic-derived class, the code provided into CMyClass::OnCtlColor won't be executed!
OnPaint seemed me a good solution but if I insert the OnPaint handler with Visual Studio, the control won't even show
---
|
|
|
|
|
4288 wrote: but if I insert the OnPaint handler with Visual Studio, the control won't even show
Did you subclass the control?[^]
led mike
|
|
|
|