|
int LoadString( HINSTANCE hInstance,
UINT uID,
LPTSTR lpBuffer,
int nBufferMax
);
Unfortunately, I couldn't understand first parameter of this function. Can you explain?
|
|
|
|
|
If the StringTable is in the same application then you can pass NULL as first parameter
|
|
|
|
|
"error C3861: 'LoadString': identifier not found, even with argument-dependent lookup"
Can you tell me that what is the reason of this error? All the parameter of this functon are correct as given below.
TCHAR sz[160];
LoadString(NULL,IDYES,sz,sizeof(sz));
|
|
|
|
|
check by incuding "windows.h"
|
|
|
|
|
mehmetned wrote: How can I use this methods or functions? (LoadStrıng or LoadResource)
See here.
"The largest fire starts but with the smallest spark." - David Crow
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
First of all i'm working in a MDI evironment
I want to create a CDialog that would kind off stay on the background of all other windows so i've placed it in the MainFrm Object:
VERIFY(pMainFrame->m_InitialDlg.Create(CInitialDlg::IDD, pMainFrame));
VERIFY(pMainFrame->m_InitialDlg.SetWindowPos(&wndBottom, 0, 0, 0, 0, SWP_SHOWWINDOW|SWP_NOSIZE|SWP_NOMOVE));
The trouble is that m_InitialDlg stays on top of all the other Windows (the Doc/View/Frame ones) Any ideea how to fix this?
Is there a beter way of doing it that does not require the CDialog..?
-- modified at 5:01 Tuesday 11th July, 2006
|
|
|
|
|
eusto wrote: The trouble is that m_InitialDlg stays on top of all the other Windows (the Doc/View/Frame ones) Any ideea how to fix this?
Set the dialog's parent to NULL . Since the MDI frame is the parent hence it stays on top of it.
Nibu thomas
A Developer
Programming tips[^] My site[^]
|
|
|
|
|
Tried it with null also it's still a modal window and hence it has top most style (as opposed to views)
|
|
|
|
|
eusto wrote: Tried it with null also it's still a modal window and hence it has top most style (as opposed to views)
How are you displaying it. Are you calling DoModal() or ShowWindow().
Nibu thomas
A Developer
Programming tips[^] My site[^]
|
|
|
|
|
|
eusto wrote: ShowWindow
I am surprised. Then how is it being displayed as a modal dialog. Are you able to interact with the parent window.
Nibu thomas
A Developer
Programming tips[^] My site[^]
|
|
|
|
|
I'm able to interact with the parent window..in fact it's just as if it weren't there. I can push buttons and stuff on views behind it...It's just that it is drawn on top of all other modeless windows. It's quite odd..try it, you'll see. Just create a MDI project, add in a dialog, add a member to that dialog to your mainframe class and call:
VERIFY(pMainFrame->m_InitialDlg.Create(CInitialDlg::IDD, pMainFrame));
VERIFY(pMainFrame->m_InitialDlg.SetWindowPos(&wndBottom, 0, 0, 0, 0, SWP_SHOWWINDOW|SWP_NOSIZE|SWP_NOMOVE));
in OnCreate method of the MainFrame class
|
|
|
|
|
eusto wrote: VERIFY(pMainFrame->m_InitialDlg.SetWindowPos(&wndBottom, 0, 0, 0, 0, SWP_SHOWWINDOW|SWP_NOSIZE|SWP_NOMOVE));
What about simple ShowWindow() Is that of any use.
Nibu thomas
A Developer
Programming tips[^] My site[^]
|
|
|
|
|
It's actually the same thing. SetWindowPos gives more options. I guess i could play with showwindow(sw_show)/showwindow(sw_hide) depending wether or not there are open documents but that's not a nice thing.
|
|
|
|
|
eusto wrote: VERIFY(pMainFrame->m_InitialDlg.Create(CInitialDlg::IDD, pMainFrame ));
This is the problem I guess. You are setting the parent to pMainFrame . Hence it stays on top of the frame. Give NULL and it will go behind.
Nibu thomas
A Developer
Programming tips[^] My site[^]
|
|
|
|
|
Ok, now my code looks like this:
VERIFY(pMainFrame->m_InitalDlg.Create(CInitialDlg::IDD, NULL));
pMainFrame->m_InitalDlg.ShowWindow(SW_SHOW);
It's still the same thing. Actually now i can't even press the buttons on m_InitialDlg.
This is the dialog's style:
DS_SETFONT | DS_3DLOOK | DS_FIXEDSYS | DS_CONTROL | DS_CENTER | WS_CHILD
|
|
|
|
|
eusto wrote: | WS_CHILD
Why is WS_CHILD given for a dialog that you want to be popup. . Lol make it WS_POPUP .
Nibu thomas
A Developer
Programming tips[^] My site[^]
|
|
|
|
|
Thanks for your help man. It's still not working though . Have you done this? Are you sure it will eventually work this way?
|
|
|
|
|
Do i need to call repaint or something anywere? If i set style to popup, it becomes visible when the user presses a button in that area of the main frame( Even though another child window is opened)
|
|
|
|
|
eusto wrote: VERIFY(pMainFrame->m_InitialDlg.Create(CInitialDlg::IDD, pMainFrame ));
Instead of pMainFrame give m_InitialDialog.GetDesktopWindow().
i.e
VERIFY(pMainFrame->m_InitialDlg.Create(CInitialDlg::IDD, m_InitialDialog.GetDesktopWindow()));
I did a small sample and this worked...
static CAboutDlg dlg;
if( dlg.m_hWnd == NULL )
dlg.Create( IDD_ABOUTBOX,dlg.GetDesktopWindow());
dlg.ShowWindow(SW_SHOW);
Nibu thomas
A Developer
Programming tips[^] My site[^]
|
|
|
|
|
Thanks...I forgot about GetDesktopWindow() ..what was i thinking?
Thanks
|
|
|
|
|
Can't draw CString string with DrawString(GDI+)
CString str=_T("test string");
FontFamily fontFamily(L"Times New Roman");
Font font(&fontFamily, 24, FontStyleRegular, UnitPixel);
PointF pointF(30.0f, 10.0f);
SolidBrush solidBrush(Color(255, 0, 0, 255));
graphics.DrawString(str.GetBuffer(), -1, &font, pointF, &solidBrush);
|
|
|
|
|
DrawString will take WCHAR* as its first argument, CString::GetBuffer() won't workout. Try using WCHAR* instead str.GetBuffer()
|
|
|
|
|
There's no need to use GetBuffer , you can simply pass the CString object, if it's the right width. I suspect you're compiling without UNICODE defined, so your CString is actually a CStringA , which does not have a conversion operator to const WCHAR* . It stores byte-oriented national character set characters. GDI+ expects UTF-16 Unicode characters. You need to either store your strings in this format, or convert them when you need to use them.
Unless you want compatibility with Windows 9x, the easiest thing to do is to simply define UNICODE and _UNICODE , or select the 'Unicode' configuration if you already have one. You need to define both macros because the Windows headers use UNICODE while the C run-time uses _UNICODE . This forces all CString objects to be UTF-16 Unicode. You'll have to fix any compile errors you get here, where you've used a string not wrapped in _T() .
Slightly more difficult is to store any strings you want to display on screen in the correct format. Here you should consider using CStringW objects (I'm assuming you're using at least MFC 7.0 from Visual Studio .NET 2002, rather than MFC 6.0). You can construct a CStringW from byte-oriented national character set data (char* ). You can convert at the point of use if necessary. Using CStringW is slightly more straightforward than trying to use the MultiByteToWideChar API directly.
If explicitly using the wchar_t , WCHAR or CStringW datatypes, you should use the L"" syntax to specify your string literals, rather than _T() . Only use _T() for values that should change format depending on whether _UNICODE is defined.
Stability. What an interesting concept. -- Chris Maunder
|
|
|
|
|
CPropertySheet properties(_T("вфыавав"), this, 0);//error C2664: 'CPropertySheet::CPropertySheet(UINT,CWnd *,UINT)' : cannot convert parameter 1 from 'const wchar_t [13]' to 'UINT'
??? but CPropertySheet have constructor with LPCTSTR as the 1st parameter
explicit CPropertySheet(
LPCTSTR pszCaption,
CWnd* pParentWnd = NULL,
UINT iSelectPage = 0
);
|
|
|
|