|
Hello all,
This should be real simple, just don't know where to start. Basically I need to create from an application a web page and post it on my web site. How can I do this?
thanks
Ralph Krausse
|
|
|
|
|
Hello everybody,
Here is my problem.
I'm trying to display a dialog and in the Create() function I'm getting an assert error. I dig up through the debugger and I found out where I'm getting the assert error is in AfxGetResourceHandle(). Here is my code:
int APIENTRY WinMain(HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPSTR lpCmdLine,
int nCmdShow)
{
CMainDlg *mainDlg = new CMainDlg();
BOOL bRet = mainDlg->Create(IDD_MAIN_DIALOG, NULL);
if (bRet != 0)
{
mainDlg->ShowWindow(SW_SHOW);
}
else if(bRet == 0)
{
AfxMessageBox("Error Creating Dialog");
}
return 0;
}
As you noticed, all I'm trying to do is to display a dialog. Is there anything that I have to set in advance before I create the dialog and display it? Any answer is more than welcome.
Best regards,
Luis E. Cuadrado
)
|
|
|
|
|
It has been a long time since I have done MFC, but since you have replaced MFCs WinMain, it has been unable to initialize.
What you should have done is display your dialog from the InitInstance method of your CApplication class.
Tim Smith
I'm going to patent thought. I have yet to see any prior art.
|
|
|
|
|
Have you stepped through the Create() code to see why afxCurrentResourceHandle is still NULL?
|
|
|
|
|
Hi DavidCrow,
Yes, I stepped through the Create() code. The assertion is comming in the AfxFindResourceHandle() function. I included the portion of the code where the assert error comes and I pointed out where the assert error occurs. Aparently the value pModuleState->m_bSystem returned by AfxGetModuleState() is causing the assert error. Here is the code.
HINSTANCE AFXAPI AfxFindResourceHandle(LPCTSTR lpszName, LPCTSTR lpszType)
{
ASSERT(lpszName != NULL);
ASSERT(lpszType != NULL);
HINSTANCE hInst;
AFX_MODULE_STATE* pModuleState = AfxGetModuleState();
if (!pModuleState->m_bSystem)
{
hInst = AfxGetResourceHandle();
if (::FindResource(hInst, lpszName, lpszType) != NULL)
return hInst;
}
.
.
.
I hope this helps. Before I forget, thanks for your reply David
Luis E. Cuadrado
)
|
|
|
|
|
Technically, the assertion is being fired within the inline function AfxGetResourceHandle(), which, in this case, is being called by AfxFindResourceHandle(). Have you tried Tim's suggestion? I've never tried creating an MFC application without the other supporting pieces in place.
|
|
|
|
|
I'm going to try Tim's suggestion. As soon as I find something, I will post back the results.
Thanks for your replys.
Luis E.
Luis E. Cuadrado
)
|
|
|
|
|
Simple. In order to use MFC you must initialise it first.
if(!AfxWinInit(::GetModuleHandle(NULL), NULL, ::GetCommandLine(), 0))
{
return 1;
}
Then your MFC operations will work as normal . You don't need to call any cleanup functions at the end.
Ryan
Being little and getting pushed around by big guys all my life I guess I compensate by pushing electrons and holes around. What a bully I am, but I do enjoy making subatomic particles hop at my bidding - Roger Wright (2nd April 2003, The Lounge)
Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late - John Nichol "Point Of Impact"
|
|
|
|
|
I use SHChangeNotifyRegister api to monitor the filesystem notification.
But I find when I copy a lot of files(>=20),The number of the posted notification: SHCNE_CREATE not equals to the number of the files. the Shell allways post about 10 SHCNE_CREATE notification, then follow a SHCNE_UPDATEITEM notification, This is not the acion I need.
Does anything wrong. But If the number of files to copy is less than 10,All is right.
How to do? help!!!
|
|
|
|
|
What value are you using for fSources?
|
|
|
|
|
(0x0001 | 0x0002 | 0x1000)
any wrong?
|
|
|
|
|
Looks fine. The shell also only has a 10-item event buffer, and may replace some events with a generic SHCNE_UPDATEDIR in case of an overflow. In short: don't depend on these notifications for any mission-critical applications.
|
|
|
|
|
SHChangeNotifyRegister(hWnd, SHCNF_ACCEPT_INTERRUPTS | SHCNF_ACCEPT_NON_INTERRUPTS | 0x1000,
SHCNE_CREATE | SHCNE_DELETE | SHCNE_RENAMEITEM | SHCNE_UPDATEITEM |
SHCNE_MKDIR | SHCNE_RMDIR | SHCNE_RENAMEFOLDER | SHCNE_UPDATEDIR |
SHCNE_NETSHARE | SHCNE_NETUNSHARE | SHCNE_FREESPACE,
WM_SHELLNOTIFY,
1, pEntry);
pEntry pointer to a special directory, such as "C:\\test"(use pidl).
|
|
|
|
|
But the explorer looks work fine, why it can do this?
Has there any method to repair this action?
|
|
|
|
|
zmnie wrote:
But the explorer looks work fine, why it can do this?
How do you know this? How can you tell that it is receiving more than 10 notifications?
|
|
|
|
|
I copy files to a folder, there are thousands files in that folder.
If flush the display of this folder, it will take mostly 2 second and cpu usage maybe nearly 100%.
But I find the cpu usage of explorer is only 10%, and last no more than 1 second, and the display is right, how do you thant about it?
|
|
|
|
|
Hi there,
I am trying to write a parser for a stream of data coming in my serial port. Does anyone know of a good article/site that gives info about writing/theory of parsing data streams.
thanks
A
|
|
|
|
|
I want to add a special icon to system image list.
but when I use Imagelist_addicon to add a special icon, it will occupy the place which other system icon used.
So improper icon is display.
How can I add a special icon to system imagelist, just like SHGetFileInfo does?
|
|
|
|
|
Hi,
The project that i worked month before is having a .mak file for building.
I don't want to use the .mak file and use normal project settings. so that i can do things as usual.
any body knows how to bring my project to normal shape, in the sense, removing the .mak file and making normal settings available..
thanx
Harinath
Harinath Reddy
HOneywell Technology Solutions Lab,
Bangalore,
India-560076
|
|
|
|
|
Try the Insert Project Into Workspace under the Project menu.
|
|
|
|
|
You have to create a new project and then add all your files to the project. There is no converter that takes a .mak and produces a .dsp.
John
|
|
|
|
|
I tried this way(creating new project).
it worked also.
thanx
Harinath
|
|
|
|
|
typedef bool (* DispatchFunc)(void *pcontext);
what does the above sentence mean?
|
|
|
|
|
A synonym of a pointer to the function
whose parameter is pcontext,
whose returned value is of type bool.
Is it right?
|
|
|
|
|
It's a function pointer named DispatchFunc, that returns a bool, and accepts a void pointer as a parameter.
|
|
|
|