|
But in that, File -> New doesn't work, File -> Open doesn't open the text file, and File -> Save doesn't save the content.
|
|
|
|
|
Hi,
I'm having troubles processing my user messages so I think I'm leaving some code line.
I do this:
#define WM_ICON_NOTIFY WM_APP+10
...
int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,LPSTR lpCmdLine, int nCmdShow)
{
...
while (GetMessage(&msg, NULL, 0, 0))
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}
...
}
...
inicialize the structure NOTIFYICONDATA:
...
icon.uCallbackMessage = WM_ICON_NOTIFY;
...
and process the messages:
LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
...
switch (message)
{
case WM_ICON_NOTIFY:
my action
.....
but anything I do in case WM_ICON_NOTIFY there's not response, so I'm sure the program doesn't receive the messages when click a mouse button over the icon, for example.
What i'm doing wrong?
Thanks!
|
|
|
|
|
lillah wrote:
#define WM_ICON_NOTIFY WM_APP+10
instead of using WM_APP use WM_USER
and try sending Dummy message to your application,to se wheather you are receiving message or not using
PostMessage or SendMessage Apis
Really these apis are very Easy and Whole window system depend on it,REALLY
-----------------------------
"I Think It Will Help"
-----------------------------
Alok Gupta
visit me at http://www.thisisalok.tk
|
|
|
|
|
I've tried with PostMessage and SendMessage and nothing, app doesn't receive anything.
With WM_APP or WM_USERS occurs the same.
One question, in Project Settings i'm using MFC in a static library because with Not MFC I have problems to linking:
nafxcwd.lib(thrdcore.obj) : error LNK2001: unresolved external symbol __endthreadex
nafxcwd.lib(thrdcore.obj) : error LNK2001: unresolved external symbol __beginthreadex
If I use MFC in a static library i have to do a MESSAGE_MAP? Will it be this the problem?
I haven't an own class so i don't know how to do a message map.
--Modify-- I've modified the program to NOT use MFC ant continues the trouble
|
|
|
|
|
I got it!!!!!!
I've created another invisible window that it will be POPUP for the icon, so the app message from the taskbar are processed well.
Ufffff.
ThatsAlok, thank you very much for your help in all my threads, you help me a lot, I'm newbie and i'm lose easily
Thanks
|
|
|
|
|
Thanks
You are always Welcome Sir.
-----------------------------
"I Think It Will Help"
-----------------------------
Alok Gupta
visit me at http://www.thisisalok.tk
|
|
|
|
|
I have a UI basically consisting of a CWnd (the Bad Window)as a child of a CTabCtrl as a child of a CWnd ( a placeholder ) inside a docking window.
When creating the hierarchy, every UI window is created and resized properly up to The Bad Window; upon Spy++ing it, I find that its size and position is (0,0,0,0)
I suspect that at one level, when I do a MoveWindow on a UI, it does not propagate the WM_SIZE because the size is the same.
I have something like in an OnSize Handler:
CRect rect;
GetClientRect( rect );
rect.DeflateRect( 2, 2, 2, 2 );
m_pController->MoveWindow( rect );
I suspect the size of m_pController is the same as rect and does not trigger a WM_SIZE.
When I manually resize the docking window, all is fixed and resized nicelly.
Is there a way to force a WM_SIZE to be triggered ? or maybe I'm missing some obvious thing ?
Can SetWindowPos be used to help fix the problem ? ( I will try that ... )
Thanks.
Maximilien Lincourt
Your Head A Splode - Strong Bad
|
|
|
|
|
Hi,
I want to change the dialog box size so that it fits my computer screen without having any horizontal or vertocal scroll bars. Is it possible to do this by changing the property of the dialog box. Its just the one time change the user is not going to alter its size.
please help me out. I read a few articles where i need to include new class. can anyone please help me on this
|
|
|
|
|
Use GetSystemMetrics() to get the current resolution. Then use SetWindowPos() or MoveWindow() to change the size.
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
1. i have a menu option. when i choose option A, a child window appears with about 25 controls on it, The child window takes the default dialog window size. I am keen on increasing teh size of this child window coudl you please help me on how i can do this.?
|
|
|
|
|
Araj01 wrote:
I am keen on increasing teh size of this child window coudl you please help me on how i can do this.?
If you want to set the size of the dialog, do so by calling SetWindowPos() or MoveWindow() in the dialog's OnInitDialog() method.
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
Hello, everybody
I have a problem with the GetPrinter call. I use the following code to get the printer info:
// The printer Information (PRINTER_INFO_2)
// is pointed to by m_pPrinterInfo
BOOL CAutoApp::GetPrinterInfo()
{
HANDLE hPrinter = GetPrinterHandle( (char*)((LPCTSTR)(m_printer)) );
if ( hPrinter == NULL ) return FALSE;
// Release previous information
if ( m_pPrinterInfo != NULL )
{
free(m_pPrinterInfo);
m_pPrinterInfo = NULL;
}
DWORD cByteNeeded, cByteUsed;
// Get the buffer size needed
if (!GetPrinter(hPrinter, 2, NULL, 0, &cByteNeeded))
{
if (GetLastError() != ERROR_INSUFFICIENT_BUFFER)
{
_stprintf( m_szLog, "Error code: %u\r\n", GetLastError() );
PrintFileLog::WriteLog( m_szLog ); // winerror.h
PrintFileLog::WriteLog( "Failure to get the printer Info buffer size" );
CloseHandle(hPrinter);
return FALSE;
}
}
m_pPrinterInfo = (PRINTER_INFO_2 *)malloc(cByteNeeded);
if ( m_pPrinterInfo == NULL )
{
// Failure to allocate memory
PrintFileLog::WriteLog( "Failure to allocate memory for the printer Info" );
CloseHandle(hPrinter);
return FALSE;
}
// Get the printer information
if (!GetPrinter(hPrinter,
2,
(LPBYTE)m_pPrinterInfo,
cByteNeeded,
&cByteUsed))
{
// Failure to access the printer
PrintFileLog::WriteLog( "Failure to obtain the printer Info" );
CloseHandle(hPrinter);
free(m_pPrinterInfo);
m_pPrinterInfo = NULL;
return FALSE;
}
CloseHandle(hPrinter);
return TRUE;
} // GetPrinterInfo
When I apply the method to my local printer I get the number of jobs submitted to the printer. However, when I try to get the number of print jobs for a network printer I always get it = 0.
I use the testing procedure
void CAutoApp::printerJobs()
{
// begin testing
int cnt = 0;
bool bJobFound = false;
do
{
if ( GetPrinterInfo() )
{
if ( m_pPrinterInfo->cJobs > 0 )
{
bJobFound = true;
break;
}
}
if ( !bJobFound )
{
Sleep( 5 ); cnt++;
}
} while ( !bJobFound && cnt < 10000 ); // 50 secs wait
if ( bJobFound )
MessageBox(NULL, "Print Job Found!", "Test", MB_OK);
else
MessageBox(NULL, "Print Job Not Found...", "Test", MB_OK);
return;
} // printerJobs
to capture the event (m_pPrinterInfo->cJobs > 0).
I don't know why it works differently for both printers. My access rights to both printers are 'Administrator access rigths' (Print, Manage Printers, Manage Documents, Special Permissions).
I'd appreciate any hint.
Thank you.
Nuren
Nuren
|
|
|
|
|
hello
i have a data base in prolog and i want to transfer it to excell and make some transformation ,i would like to know if there some API or command who can help me in this work?
|
|
|
|
|
My first question would be is this sort of thing even possible (i.e., exporting the Prolog database to something that Excel can understand)? If it can be done manually, chances are there's a way to do it via code.
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
i could transfer the prolog database to text file ,and now i am looking to transfer it to excel file .
|
|
|
|
|
That'll probably work, but you need to make sure that the format of the text file is understandable by Excel. To verify this, export the Prolog database to a text file and try to open the file via Excel. It will ask you about the delimeters used in the file. If you can successfully open the file via Excel, then you can do the same thing with code.
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
I am new to C++ (formally VB developer) and I am trying to use MFC.
I cannot figure out just how to create a simple dialog box and access a newly created text box with "Hello".
Can anyone help me with this or point me to a link that will help.
Thanks,
|
|
|
|
|
|
Hi
Am am trying to automatically open email by using C++ to drive Outlook 2003. I use #import to get the correct libraries and everything is working fine except I cannot read encrypted emails. I have an _ItemsPtr for the inbox which I can use to iterate through all the items I have received and I can read all the non-encrypted ones but I can't access the encrypted ones. When I query the IDispatch for the item to get an _MailItemPtr it says the interface is not supported.
The same code (using the appropriate libraries) works fine for Outlook 98, 2000, and 2002, just not for 2003.
Any ideas? Is there something extra I need to do for encrypted mails?
Mike
|
|
|
|
|
Hi,
I'm trying to use threads in my app and I should use static variables shared between all threads. Linking the app generates a link error: unresolved symbol static etc...
How can I avoid it?
Thanks
Vilmer
|
|
|
|
|
How are you declaring the static global variables?
Kuphryn
|
|
|
|
|
I've just declared the veriables as static, but in MyDialog class (where MyDialog is the main dialog class of my app)
|
|
|
|
|
If in the .h file for your class you have
<br />
class MyClass<br />
{<br />
static int mStatic;<br />
}
Then in the .cpp you will need the following
int MyClass::mStatic = 123;
Mike
|
|
|
|
|
One solution is to declare the global variable in stdafx.h.
Kuphryn
|
|
|
|
|
I'm using the following procedure in order to get the small icon of an
application window:
HICON GetWindowIcon
(
HWND hwnd
)
{
LRESULT lResult;
HICON hIcon;
hIcon = NULL;
lResult = SendMessageTimeout(hwnd, WM_GETICON, ICON_SMALL, 0,
SMTO_ABORTIFHUNG|SMTO_BLOCK, 1000, (DWORD_PTR *)&hIcon);
if (lResult==0) {
hIcon = NULL;
}
if (hIcon == NULL) {
hIcon = (HICON)GetClassLong(hwnd, GCL_HICONSM);
}
if (hIcon == NULL) {
hIcon = LoadIcon(NULL, IDI_APPLICATION);
}
return hIcon;
}
Sometimes, with some application, SendMessageTimeout returns a hIcon which
is different to NULL but the icon returned doesn't seem to be a small one,
although I'm using the ICON_SMALL constant. Is it normal?
I'm also using the following procedure in order to get the array of bytes
corresponding to the icon image:
int GetIconBits
(
HICON hIcon,
int iIconSize,
long* bits,
int* iIconBitsLength
)
{
ICONINFO iconInfo;
HDC dc;
BITMAPINFO bmi;
int iBits;
long maskBits[4096];
int i;
int iMask;
if(!GetIconInfo((HICON)hIcon, &iconInfo))
return -1;
if((dc = GetDC(NULL)) == NULL) {
DeleteObject(iconInfo.hbmColor);
DeleteObject(iconInfo.hbmMask);
return -1;
}
memset(&bmi, 0, sizeof(BITMAPINFO));
bmi.bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
bmi.bmiHeader.biWidth = iIconSize;
bmi.bmiHeader.biHeight = -iIconSize;
bmi.bmiHeader.biPlanes = 1;
bmi.bmiHeader.biBitCount = 32;
bmi.bmiHeader.biCompression = BI_RGB;
iBits = iIconSize * iIconSize * 32 / 8;
GetDIBits(dc, iconInfo.hbmColor, 0, iIconSize, bits, &bmi,
DIB_RGB_COLORS);
GetDIBits(dc, iconInfo.hbmMask, 0, iIconSize, maskBits, &bmi,
DIB_RGB_COLORS);
for(i = 0; i < iBits; i++) {
bits[i] = bits[i] | ((maskBits[i] != 0) ? 0 : 0xff000000);
}
(*iIconBitsLength) = iBits;
ReleaseDC(NULL, dc);
DeleteObject(iconInfo.hbmColor);
DeleteObject(iconInfo.hbmMask);
return 0;
}
There is a problem with 32-bit anti-aliased icons, which are typical in
Windows XP. The images represented by the arrays of bytes returned by this
procedure have a sort of dark area around. I guess this happens because the
procedure doesn't handle correctly the mask information or something like
that, I don't know. To tell the truth the procedure isn't mine, I've copied
it. Does anybody know how I must treat the information return by the
GetDIBits calls in order get a correct array of bytes representing the
image?
Finally, which is the real format of the array of bytes returned by this
procedure? I mean, if I'm working with 32-bit icons, I need 8 bytes in order
to represent each pixel. The image is supposed to be in a RGB format so, how
are distributed the bytes? Is it something like this?
bits[0] bits[1] bits[2] bits[3] -> (0,0) pixel
bits[4] bits[5] bits[6] bits[7] -> (0,1) pixel
...
If this is correct, how are the RGB components mapped? Is it something like
this?:
A R G B
bits[0] bits[1] bits[2] bits[3] -> (0,0) pixel
bits[4] bits[5] bits[6] bits[7] -> (0,1) pixel
...
Thanks for your help.
--
|
|
|
|
|