|
I've never found any book talking of WinCE and MFC. But anyways, MSDN documentation was enough for me even if there was a couple of difference.
Frank
|
|
|
|
|
This may seem like a wierd thing to do, but I am trying to startup a dialog based application with the main window not visiable.
I have tried setting the dialog's visibility to false, calling ShowWindow (SW_HIDE) in the OnInitDialog (), but nothing seems to hide the window. I even tried to override the OnShow function to keep the dialog from displaying, but no luck.
ShowWindow (SW_HIDE) works fine after the initial display, but I am looking for my app to come up in silent mode. Any help will be greatly appreciated.
Jennifer Glover
|
|
|
|
|
This seems to be a common dilemma for which I don't have a clear explanation. It seems like Windows does not allow you to create a modal dialog that's initially hidden. I guess the reason is: why would you ever want to? The whole purpose behind making the dialog modal is to show it and have the user interact with it. I guess the Windows designers figured, "If it's hidden, then how can the user interact with it?". So they always force modal dialog boxes to be shown.
So how do we solve your problem? Simple: make your dialog modeless. Remove the modal dialog creation code in your Project.cpp file and instead write this:
static CMyDlg s_dlg;
if (!s_dlg.Create(CMyDlg::IDD))
return FALSE;
m_pMainWnd = &s_dlg;
return TRUE;
If you uncheck the dialog resource's "Visible" flag, you won't see the dialog box until you call ShowWindow(SW_SHOW). Also, keep in mind that you'll need to call DestroyWindow to properly destroy the dialog box (and thus end the application).
Regards,
Alvaro
|
|
|
|
|
Alvaro's advice sounds good to me. If you are interested, I have written some notes about modeless dialogs.
See: http://home.socal.rr.com/samhobbs/VC/ModelessDialogs.html
Something else to play around with though is the WM_WINDOWPOSCHANGED message. Try overriding it for your dialog, so that you will have an OnWindowPosChanged function for your dialog. The last message that I have been able to detect and recognize as being the last one sent to a dialog before it is shown is a WM_WINDOWPOSCHANGED message with the SWP_SHOWWINDOW flag set in the WINDOWPOS structure. It sure sounds like something you could use, but I am not sure of the details.
|
|
|
|
|
Im working on a little graphics app and Im adding Zoom
capabilities which of course requires a magnifying glass>>
Can someone tell me whats involved ....or where I might find
an example of this....
Thanks a lot.
|
|
|
|
|
The SetCursor() API does this.
|
|
|
|
|
Hi,
I think te title say it all?
Thanks,
James
|
|
|
|
|
hi,
can some please show me/refer me to code on how to use the select function (Winsock api) .......
please i really need help here........
tnx a lot
yaron
|
|
|
|
|
Guys,
www.mindcracker.com is a new developers web site. You are most welcome to contribute and post your articles.
Thanks
|
|
|
|
|
Guys,
www.mindcracker.com is a new developers web site. You are most welcome to contribute and post your articles.
Thanks
|
|
|
|
|
Does any one know how to toggle between document templates
with a toolbar button or menu item? I what to go between a
single view and splitter view without having to do file /new
then picking from the list.
Please Help!
Any suggestion will be greatly appreicated
Thanks
|
|
|
|
|
HI,
I used CHtmlView to make a custom browser..
It works well..not powerful but basic functions and methods are enough..
One Problem..
I made OnScreen Keyboard..
But I can't route keyboard message to edit box that dynamically created in IE COM..
When clinking the Onscreen Keyboard, the input focus is moved to button of keyboard..
Worse it is when there are lots of edit boxes in Web page..
How can I route the keyboard message correctly?
OR
How can I get the handle of edit box in IE COM that has focus?
Thank you in advance!!!
-Ray
|
|
|
|
|
Hello!
I' m connecting Visual Fox Pro database with my VC program through ODBC.
When i open the recordset i get the error message "ODBC does not support dynasets".
If select Snapshot, it works fine.
I looked at MSDN: "PRB: Visual C++ 1.5 ODBC Drivers Don't Support Dynasets", but 'm not getting the right way.
Would u plz tell me how i can solve this problem.
Thanx
Hassan
|
|
|
|
|
Just an idea:
Are you using Cursors ? I think the cursor-library is necessary for snapshots, but dynasets don´t like it. So if you want to use dynasets, disable the cursor-librabry...
|
|
|
|
|
Hi all,
I'm new to WinSock. Please, if anyone know where I can find source code of how to use WSAAsyncGetHostByAddr() in an VC++/MFC application send me a mail.
I found an example of using WSAAsyncGetHostByAddr() in C/SDK app. but I have an VC++/MFC app. and I wish to update it with WSAAsyncGetHostByAddr().
Thank you,
Mileta.
|
|
|
|
|
Hi,
I hope is usefull to you:
Add this lines bellow in your InitInstance method of your application and you can use any WSA.. function .
WSADATA wsa;
WSAStartup(0x0101, &wsa);
in ExitInstance():
WSACleanup();
and
#include <winsock.h> in your stdafx.h file
also you must link your application with
wsock32.lib
It doesn't matter if your application is build with or without MFC
Best Regards,
/REMUS
|
|
|
|
|
Hello,
I'm using the CImageList ATL helper classes defined in the "ATLControls.h" file. When I try to build my project
I have link error.
here is the code where I'm using the CImageList object:
/////////////////////////////////////////////////////////////////////////////
//
LRESULT CParametersDlg::OnInitDialog(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
{
USES_CONVERSION;
//Initialize the editText name control.
CWindow wndName(GetDlgItem(IDC_ELEMENT_NAME));
wndName.SetWindowText(OLE2T(m_controlName.m_str));
//Initialize the comboxe color control
RECT rect= { 90, 130, 280, 210 };
m_comboBoxEx.Create(this->m_hWnd, rect, NULL, WS_CHILD | WS_VISIBLE | WS_BORDER |
WS_TABSTOP | WS_VSCROLL | CBS_DROPDOWNLIST);
m_comboBoxEx.SetExtendedUI();
COMBOBOXEXITEM cbei;
cbei.mask = CBEIF_TEXT | CBEIF_INDENT | CBEIF_IMAGE | CBEIF_SELECTEDIMAGE;
int sizeOfItem = sizeof( Gobal_ItemInfoArray ) / sizeof( Gobal_ItemInfoArray[0] );
for( int index = 0; index < sizeOfItem; index++ )
{
CComboBoxExColor& comboInfo = Gobal_ItemInfoArray[index];
cbei.iItem = index;
cbei.pszText = comboInfo.m_przText;
cbei.cchTextMax = sizeof(comboInfo.m_przText);
cbei.iImage = comboInfo.m_iImage;
cbei.iSelectedImage = comboInfo.m_iSelected;
cbei.iIndent = comboInfo.m_iIdent;
m_comboBoxEx.InsertItem(&cbei);
}
CImageList imageList;
imageList.Create( IDB_ORUS_COLOR_BITMAP, 16, 1, ILC_COLOR);
m_comboBoxEx.SetImageList( imageList.m_hImageList );
return 1; // Let the system set the focus
}
/////////////////////////////////////////////////////////////////////
hereis the link error message that I received:
Linking...
Creating library Debug/OrusControlsServer.lib and object Debug/OrusControlsServer.exp
ParametersDlg.obj : error LNK2001: unresolved external symbol __imp__ImageList_LoadImageA@28
Debug/OrusControlsServer.dll : fatal error LNK1120: 1 unresolved externals
Error executing link.exe.
/////////////////////////////////////////////////////////////////////
As you can see I'm using an ATL CComboBoxEx object and there is no problem with that. Do anyone have any
idea of what going one.
Thanks for your help, Alain-Serge.
|
|
|
|
|
Are you linking with comctl32.lib?
|
|
|
|
|
I have mvc++ 6.0. I have a SDI CDialog. I click on the date time picker icon and presto, I have a date time picker. I then go to class wizard and add the member variable m_datetime to IDC_DATETIMEPICKER and I change it from 'type' to 'control' so that I have declared in my header file
CDateTimeCtrl m_datetime;
When I compile the program, I get the error:
'CDateTimeCtrl' missing storage class or type specifiers
and it's referring to line that I have declared CDateTimeCtrl. I don't understand what I am doing wrong. It is my understanding the msvc++ 6.0 has the header file CDateTimeCtrl. So why do I need to enter it?
Please, any response any one can give me will be greatly appreciated.
Sincerely,
Danielle
|
|
|
|
|
You need to #include <afxdtctl.h>
|
|
|
|
|
This might be an OLE control, in which case you need to make sure you have the line
#include <afxctl.h>
in your stdafx.h file.
Otherwise, it might require the
#include <afxcmn.h>
line added to your stdafx.h file.
The build goes a lot faster if you do not include these header files if you are not using any of those controls in your project, so they are not in the stdafx.h by default.
|
|
|
|
|
I need to get a CWnd * to the window that has the focus (even if outside of my application), check to see if its a CEdit, and then do some Stuff. I have tried many thorough tests with CWnd's GetFocus(), GetForegroundWindow(), etc, and have not succeeded. It seems I can get a pointer to the CEdit's framework but not the CEdit itself. I am checking to see if its a CEdit by getting the class name and comparing to "EDIT".
Is there a better way to do this? Any help is appreciated.
|
|
|
|
|
Hello,
I've been trying to use CMap to create a hashing table of pointers to elements based on a class that specifies an unique coordinate.
Class CPonto (translates to CPoint) has 3 members: x,y,z of type UINT, and my CMap member should be able to give me a pointer to the object CMyObject if there is any at [x,y,z], or NULL if not.
Each unique coordinate refers to only one CMyObject, or NULL if it isn't ocupied.
I have declared my CMap member variable as follows:
[ccode]
#include <afxtempl.h>
CMap<cponto,cponto&,cmyobject*,cmyobject*> myWorld;
[/ccode]
However compilers generates:
[b]. D:\Program Files\DevStudio\VC\MFC\include\afxtempl.h(129) : error C2440: 'type cast' : cannot convert from 'class CPonto' to 'unsigned long'
. No user-defined-conversion operator available that can perform this conversion, or the operator cannot be called[/b]
which jumps to a line containing
[ccode]
return ((UINT)(void*)(DWORD)key) >> 4;
[/ccode]
and it seems to my that my key has to be a sizeof() 4-bytes variable, which isn't explained by MSDN.
My main question is: Is it possible to have CPonto as KEY and ARG_KEY type? How?
Thinking of what error says: "No user-defined-conversion operator available that can perform this conversion"... Does it mean i can do that (programatically specify an automatic operator that converts CPonto to DWORD)? How?
Note: UINT types for CPonto members x,y,z could be of type BYTE, so it would fit in 3 of the 4 byte of DWORD, still, i don't know if CPonto's definition correctly aligns these members, but anyway, i bet it can be done, so i'm asking here. Also, i'm trying to use CMap to avoid certain limitations I have with other ways, mainly the resources needed only to reach a coordinate like (100,100,100) - memory - ie, there is no sense in using an UINT to store a XYZ coordinate like (500,500,500) if most of the times user can't reach it, right? I think that with CMap it would be possible.
If you can be of any help... Thanks in advance,
|
|
|
|
|
Hello, Nuno!
See: http://home.socal.rr.com/samhobbs/VC/Collections.html
That might help you. The importnat hting is that instead of:
CMap myWorld;
you probably need something like:
CMap <dword, dword,="" cmyobject,="" cmyobject&=""> myWorld;
Does that look like what you want?
I prefer to use typedefs, so I would do that this way:
typedef CMap <dword, dword,="" cmyobject,="" cmyobject&=""> CMyObjectMap;
CMyObjectMap m_MyObjectMap;
Yes, I think that you are correct that default hash keys are four bytes, because someone in the CodeGuru forum said that, but when I asked him where in the documentation it says that he said he did not want to answer my question because I had given him a negative rating for saying that he was not spamming CodeGuru with a message about the CodeProject web site.
|
|
|
|
|
Hey! I know I did the first reply correctly; it must have gotten messed up by this CodeProject thingee. I sure miss the CodeGuru's preview feature. I took advantage of it often.
I will do my post again and this time I will be sure to copy the password number for fixing this one.
Ok, I got the same result this time that I got the first time. The problem seems to be the brackets used as delimiters for STL. So in the code below use a less-than-symbol ("<") instead of "{" and use a greater-than-symbol (">") instead of "}". This CodeProject forum software seems to exclude text between the "angle" brackets.
So what I meant to say is that instead of:
CMap myWorld;
you probably need something like:
CMap {DWORD, DWORD, CMyObject, CMyObject&} myWorld;
Does that look like what you want?
I prefer to use typedefs, so I would do that this way:
typedef CMap {DWORD, DWORD, CMyObject, CMyObject&} CMyObjectMap;
CMyObjectMap myWorld;
|
|
|
|
|