|
add this line after the "includes"
#pragma comment(lib,"ddraw.lib")
regards
|
|
|
|
|
|
gern geschehen
|
|
|
|
|
You need to add the .lib library of Direct Draw in the settings of yor project, do ALT+F7, or prject/settings in the menu of vc++, select the link tab, and add the library. Y don't have the MSDN here, but i think that is ddraw.lib
Cheers....
Carlos Antollini.
|
|
|
|
|
- Please take a look at the two macros:
#define DEBUG(x) cout<<#x"="<
|
|
|
|
|
# and ## are preprocessor commands. #x results in the substitution "x" while x##y results in xy .
DEBUG(var) becomes cout<<"var""="<<var<<endl;
FIELD(MyField) becomes char* MyField_string; int MyField_size
And if you're wondering what happens to "var" "=" , the preprocessor concatentates adjacent string literals, so that becomes "var=" .
--Mike--
http://home.inreach.com/mdunn/
"....." -- Silent Bob
your with and
|
|
|
|
|
Thanks Mike pal!
- I still have a question. Do you mean x##y results in a single identifier?
- Can you help?
- Have a nice day?
Thanks,
Maer
|
|
|
|
|
|
I have two dialogs.
I the main dialog which is shown when the app is starting, I write this in the OnInitDialog():
CSecondDialog dlg; // this is the other dialog!
dlg.m_checkbox.SetCheck(1); // m_checkbox is a simple Check Box control, I puted it on the dialog with drag-and-drop
The program crashes and the debuger shows this
_AFXWIN_INLINE void CButton::SetCheck(int nCheck)
{ ASSERT(::IsWindow(m_hWnd)); ::SendMessage(m_hWnd, BM_SETCHECK, nCheck, 0); }
Is there any options for the Check box that isn't avaible?
or....
|
|
|
|
|
It is failing because the checkbox hasn't been created yet, the check box won't be created until the InitDialog function of CSecondDialog has been completed.
The easiest solution would be to create a BOOL flag for the checkbox, set that and then inside the CSecondDialog::InitDialog do the SetCheck code. Either that or use the built in DDX functionality of CDialog.
Michael
|
|
|
|
|
Well , I successed to create my first ATL and it is works.
But the problem that remains is that I dont success to use full at the controls of the ATL Dialog. [ATL object][Miscellaneous][Dialog]
the code line's :
--------------------------------------------
CEdit* pText = (CEdit*)GetDlgItem(IDC_EDIT1);
pText->SetWindowText("Hello! ");
pText->UpdateWindow();
-------------------------------------------
or:
--------------------------------------------
CStatic* image = (CStatic*)GetDlgItem(IDC_PICTURE);
image->......
.....
----------------------------------------
cause to crush the program in run time.
How can I use at the controls correctly ?
|
|
|
|
|
Where is this code being called from, is it before or after the InitDialog. Also what error message are you getting?
Off the top of my head, I thought the GetDlgItem returned a HWND so you can't cast it to a CEdit.
In my ATL/WTL dialogs I do the following,
declare a CEdit variable in the dialog class
CEdit m_editDest
and then in my InitDialog
m_editDest = GetDlgItem(IDC_NUMBER);
m_editDest.LimitText(64);
Michael
|
|
|
|
|
GetDlgItem returns CWnd* , so the code that mimi writed is correct.
apparently there are another problem.
|
|
|
|
|
CWnd::GetDlgItem returns a CWnd*, but ::GetDlgItem returns a HWND. CWindow::GetDlgItem ( the ATL function ) returns a HWND also.
As the code mimi provides does not call GetDlgItem in the scope of an instance of CWnd, unless it is inside an MFC CWnd derived class, Michael is correct.
Christian
As I learn the innermost secrets of the around me, they reward me in many ways to keep quiet.
Men with pierced ears are better prepared for marriage. They've experienced pain and bought Jewellery.
|
|
|
|
|
If mimi is using an ATL Wizard created dialog, then CWnd doesn't exist. The only GetDlgItem in the Atl DialogImpl class is the one which returns the HWND. Although looking at the answers further down it looks like he isn't using ATL correctly.
Michael
|
|
|
|
|
Thank you !
1. This my code called from OnOk func of CDialog.
2. The project pass compilation without errors or warnings But in run time when the program arrive to this lines I gets message error that performed illegal action and the program will close.
|
|
|
|
|
In your question you say that you are using an ATL generated Dialog class, but CDialog is an MFC class. Can you post the class defintion so that I can see which kind of framework you are using as I'm getting confused.
Michael
|
|
|
|
|
not CDialog .
But your suggestion cause error at compilation:
It is not returns CEdit
|
|
|
|
|
My fault too. I only gave you half a story. ATL doesn't support CEdit natively. There are two ways you can get a CEdit control in an ATL dialog. The easiest way is to use the WTL headers that come with the platform sdk or secondly you can read the following knowledge base item http://support.microsoft.com/support/kb/articles/Q223/4/39.ASP
Michael
|
|
|
|
|
Hello, the codegurus around the world.
Try CWindow to deal with Edit box!
USER_CONVERSION;
CWindow wnd;
CComBSTR bstr;
wnd = GetDlgItem (IDC_EDIT1);
wnd.GetWindowText (&bstr);
wnd.SetWindowText (_T("I like ATL!"));
Have a nice day!
-Masaaki Onishi-
|
|
|
|
|
The guide of you (mainly of christian and Masaaki ) was excellent,
Now I have the last question for this project (so I hope):
Which files of the ATL DLL project I need to provide for Delphi except MyAtl.DLL ???
Because in client program in VC++ I need also :MyATL.h and MyATL_i.c.
|
|
|
|
|
I am trying to register my ActiveX control, but it gives me an error of failing under WinNT because i am using an API that needs a special DLL to exist under windows directory and it works only in Win2000 and Win98 platforms. How can I make my control register under WinNT without the need of having this DLL under the system directory?
Daed
|
|
|
|
|
What is the name of the special DLL? If you want the code to work on WintNT you will have to avoid calling the unsupported functions. I usually do this by have a pre-processor define for NT and compiling a special version of my application for NT.
Michael
|
|
|
|
|
The DLL is Msimg32.dll, i need it because i am using AlphaBlend function in one of my control's property. Is there anything i can do at registry time to solve this problem?
Daed
|
|
|
|
|
You need to link dynamically to the DLL import. Load the DLL with LoadLibrary() and try to get the function's address with GetProcAddress(). If that succeeds, then use the pointer GetProcAddress() returns to call the API. If that returns NULL, then the API is not available.
--Mike--
http://home.inreach.com/mdunn/
"....." -- Silent Bob
your with and
|
|
|
|