|
I have a problem in which the function GetPrinterDeviceDefaults, (a member function of CWinApp) is failing in debug mode but its working well in release mode.. some one please help me i couldnt figure out whats the problem and i am at my wits end ..
|
|
|
|
|
I seem to remember there was a trick to this too. Could you tell us where you are crashing - in your code, or MFC ? What's the error ? What's the line of code ?
Christian
#include "std_disclaimer.h"
People who love sausage and respect the law should never watch either one being made.
The things that come to those who wait are usually the things left by those who got there first.
|
|
|
|
|
I have a problem in which the function GetPrinterDeviceDefaults, (a member function of CWinApp) is failing in debug mode but its working well in release mode.. some one please help me i couldnt figure out whats the problem and i am at my wits end ..
|
|
|
|
|
I created a MCI window in my application:
m_hMCIWnd=MCIWndCreate(this->GetSafeHwnd(), NULL, NULL, "c:\\test.avi");
This creates MCI window with the PlayBar.
All the commands invoked from the PlayBar (or right-click on the playback window), like: View, Speed, Close, Volume etc... are working. But when I choose Open it doesn't do anything!!!
Then I tried to invoke Open dialog programmatically:
LONG xx=MCIWndOpenDialog(m_hMCIWnd)
But this return allways -1 and nothing is displayed ???????
If anyone could help me, I'd appreciate it very much.
Thanks in advance.
Jerzy
|
|
|
|
|
Hi there,
I am sort of new to the world of MFC and I was building a ListView and I need to add column name to the listview at runtime.
As it stands, it appears that pszText of the listview doesn't take CString values. So, tried assigning the CString to a TCHAR array. The only way I could find was by going to through every CString letter and then adding it to the TCHAR array ... i.e.
TCHAR tcArray[500];
ZeroMemory(tcArray);
for(int i =0; szString.GetSize(); i++)
{
tcArray[i] = szString.GetAt(i);
}
I was wondering if there is a more elegant way of setting a TCHAR array to a CString or this is it! i.e. a certain copy function or an overloaded operator, etc...
thanks a lot!
However, this leaves me with all those extra
|
|
|
|
|
strcpy(tcArray, szString)
|
|
|
|
|
There is only a CString to const THCAR* conversion defined. If you need a modifiable buffer from a CString you should take a look at the GetBuffer and ReleaseBuffer member functions.
If you need a TCHAR* and are sure that the string is not modified you can use something like this:
TCHAR* ptchar = (TCHAR*) (const TCHAR*) cstring;
But be carefull.
Oliver
|
|
|
|
|
It's a long time I was last on codeproject.com, therefore i'm not up-to-date
I'd like to know whether someone already programmed
menus that look like the one's in Office XP. I didn't find any resources on this side.
Thanks in advance
|
|
|
|
|
Its not free, but the BCGControlBar library does a good job of them.
-Ben
---------
On the topic of code with no error handling -- It's not poor coding, it's "optimistic"
|
|
|
|
|
Its not free
It depends on the type of project you'll be working on. If it will be freeware then the license is free, otherwise it will cost you.
|
|
|
|
|
Hi, I am trying the following code to enumerate child windows of Start Menu. However, it doesn't seem to work. Could you take a look and tell me what I did wrong or is there another way to do it. Thank you very much.
RECT rcMenu;
BOOL CaptureMenuToClipboard(BOOL fIncMouseCursor, BOOL fIncMenuBar)
{
/*BOOL bSuccess = FALSE;
POINT ptStartMenu;
ptStartMenu.x = 1;
ptStartMenu.y = 1;
HWND hStartMenu;
HWND hShellTrayWindow = FindWindow("Shell_TrayWnd", NULL);
hStartMenu = ChildWindowFromPoint(hShellTrayWindow, ptStartMenu);
if (EnumChildWindows(hStartMenu, (WNDENUMPROC)EnumChildProc, NULL))
bSuccess = TRUE;
if (bSuccess)
{
if (!CopyScreenToClipboard(NULL, &rcMenu, fIncMouseCursor))
bSuccess = FALSE;
}
return bSuccess;*/
}
BOOL CALLBACK EnumChildProc(HWND hwnd, LPARAM lParam)
{
BOOL bFlag = FALSE;
if (GetWindowRect(hwnd, &rcMenu))
bFlag = TRUE;
return bFlag;
}
|
|
|
|
|
What do you mean by "enumerate child windows of Start Menu"? the start menu button does not have any child windows, unless you mean the menu, but it will not exist until you depress the start menu button(though its probably cached somewhere).
-Ben
---------
On the topic of code with no error handling -- It's not poor coding, it's "optimistic"
|
|
|
|
|
Hi, I am trying the following code to enumerate child windows of Start Menu. However, it doesn't seem to work. Could you take a look and tell me what I did wrong or is there another way to do it. Thank you very much.
RECT rcMenu;
BOOL CaptureMenuToClipboard(BOOL fIncMouseCursor, BOOL fIncMenuBar)
{
/*BOOL bSuccess = FALSE;
POINT ptStartMenu;
ptStartMenu.x = 1;
ptStartMenu.y = 1;
HWND hStartMenu;
HWND hShellTrayWindow = FindWindow("Shell_TrayWnd", NULL);
hStartMenu = ChildWindowFromPoint(hShellTrayWindow, ptStartMenu);
if (EnumChildWindows(hStartMenu, (WNDENUMPROC)EnumChildProc, NULL))
bSuccess = TRUE;
if (bSuccess)
{
if (!CopyScreenToClipboard(NULL, &rcMenu, fIncMouseCursor))
bSuccess = FALSE;
}
return bSuccess;*/
}
BOOL CALLBACK EnumThreadWndProc(HWND hwnd, LPARAM lParam)
{
BOOL bFlag = FALSE;
if (GetWindowRect(hwnd, &rcMenu))
bFlag = TRUE;
return bFlag;
}
|
|
|
|
|
Does anyone have any suggestion, tips, or code snippets on how to do a AutoScroll(automatically scrolling the scroll bar to capture entire client area content) Screen Capture on Client Area Window? Thank you very much.
|
|
|
|
|
Hi there,
I am able to capture pop-up menu using this code.
HWND hPopupMenu = FindWindow("#32768",NULL);
if (hPopupMenu && IsWindowVisible(hPopupMenu))
GetWindowRect(hPopupMenu, &rcMenu);
This doesn't work for Microsoft Office Products and Windows Explore 'cause their menus are not standard menu. For instance, Microsoft Word. I am trying this. I used Spy++ to find out the class name and window caption for the menu bar. I tried FindWindow("MsoCommandBar", "Menu Bar") on Microsoft Word. It doesn't work at all. Could someone give me some pointers how to capture pop-up windows from Microsoft Office Products and Windows Explorer. Thank you very much. Will EnumChildWindows or EnumThreadWindows API functions help for this case? If so, could you gimme some tips. Thank you again.
|
|
|
|
|
whose class name should be "MsoCommandBarPopup"
|
|
|
|
|
Can anyone tell me why the MIDL compiler expands boolean and wchar_t
types to char and short in type libraries instead of unsigned char and
unsigned short as they are declared?
|
|
|
|
|
In an application I'm working on I just got a messagebox with the following:
<br />
The exception Breakpoint<br />
A breakpoint has been reached<br />
(0x80000003) occured in the application at location...<br />
"The exception Breakpoint"???
I have never seen that one before, anyone knows what that is?
Behind that messagebox, another one pops up saying:
Debug Assertion Failed in dbgheap.c
Expression: -pFirstBlock == pOldBlock
Well, the last one I can understand, but again, anyone out there that knows woth the first one meens?
The funny thing is that when it's running under the debugger it never happens, but when I run the debug version, this happens.
- Anders
Money talks, but all mine ever says is "Goodbye!"
|
|
|
|
|
The code asserted; that exception was caused by an int 3 . That also explains why it only happens in the debug build.
--Mike--
http://home.inreach.com/mdunn/
Sometimes, arming yourself with a big pointy stake just won't do you any good.
|
|
|
|
|
It also happens in the release version.
But why don't it happend under the debugger. I have also tried with Purify NT, and it finds nothing...
- Anders
Money talks, but all mine ever says is "Goodbye!"
|
|
|
|
|
hmm, well there's still an int 3 in there somewhere that's getting hit. VC must be handling the exception itself - watch the Debug window and see if it shows any first-chance exceptions.
You can make VC break when it gets that exception. Start the app under the debugger, click Debug->Exceptions. Add a new handler - Number=800000003, Name=Breakpoint, Action=Stop Always
--Mike--
http://home.inreach.com/mdunn/
Sometimes, arming yourself with a big pointy stake just won't do you any good.
|
|
|
|
|
Thanks Mike, I'll try that.
This one have really bugged me for a couple of days now
- Anders
Money talks, but all mine ever says is "Goodbye!"
|
|
|
|
|
I just found the bug. It was a really stupid one
I'm using several threads, but was linking to the singlethreaded lib's...
Anyway, thanks for your help
- Anders
Money talks, but all mine ever says is "Goodbye!"
|
|
|
|
|
Anders
Are linking the debug build with any release libraries? Possibly a third party lib for which you only have the release version?
|
|
|
|
|
nope, right now the app. only uses windows.h, winsock2.h and tchar.h
It's still in the very erly start of my project, it's only 1.800 lines code right now...
- Anders
Money talks, but all mine ever says is "Goodbye!"
|
|
|
|