|
Hi,
But mbuild from Matlab is able to create the .dll file fine. Then why does this .cpp file not have the #pragma? And how can I tell which libs are needed?
Is that the only error?
|
|
|
|
|
You may find that you get some better answers on the MATLAB web site, someone else may have solved this already. The problem you have is with the output of your matlab generator, rather than with the .cpp files. txtspeak is the realm of 9 year old children, not developers. Christian Graus
|
|
|
|
|
0. Please start the VS wizard to create a DLL project
(now you product is an EXE - see the last output line)
and then fill it with your additional code.
1. Please start the "Find in files" tool (find in *.c; *.cpp; *.lib)
to find the variable __MCC_libmatrix_component_data in MATLABs dirs -
you could try to add the found *.cpp or *.lib in to your DLL project.
Good luck
PS. The answer for your why is:
MATLAB has the __MCC_libmatrix_component_data inside (not as an extern)Check your definition of Irrationality[ ^]
1 - Avicenna
5 - Hubbard
3 - Own definition
|
|
|
|
|
Long post. I think I read more questions in it than you actually asked.
I have no personal experience with MatLab or MetaTrader, so at some point here I might be indulging in a bit of speculation. (You do know about speculation, no? )
skyhr wrote: LIBCD.lib(crt0.obj) : error LNK2001: unresolved external symbol _main
The references to crt0.obj and unresolved external symbol _main sound to me like the build configuration is trying to pull in the start up code for a standalone program rather than the DLL that you are trying for. Are you sure that you have your project configured for a DLL and not an exe? Another possibility: I have seen comments that this can be caused by calling for _ATL_MIN_CRT in your project settings. I believe that for your purposes, you will not be using ATL at all, so check your project settings for that.
skyhr wrote: I've done ... is include the necessary .lib files - mclmcr.lib mclmcrrt.lib ...
--------------------Configuration: libmatrix - Win32 Debug--------------------
...
libmatrix.obj : error LNK2001: unresolved external symbol ___MCC_libmatrix_component_data
First a side note. There are several ways that you tell a linker what to include: entries in a project file, command line arguments, and embedded directives in a code module. The pragma mentioned by the earlier poster is the latter method. When you cleared up most of your unresolved externals by including a couple of libs, you probably did it via a project file. It works just fine that way too. The matlab build probably used the command line. So, the reason matlab could build successfully without the pragma directives was that it used a different method to tell the linker about the library. They are all legitimate approaches.
Now, I was going to say that this unresolved external just meant that you were missing another lib file. Then I looked closer and decided that I was wrong. Notice the libmatrix in the symbol which is your name, not matlab's. Also note the line extern mclComponentData __MCC_libmatrix_component_data; in you cpp file. This says that there is such a thing, but it is either being defined later or in a different file. Further, the matlab site states: Encrypts MATLAB code so that it cannot be viewed or modified. My current theory is that the matlab compiler is taking your code, mucking with it, and sticking it in another file. This one just contains the interface. You said, "This got me several files, like the .cpp, .h, and .dll files." Is there another file? Maybe even a .obj file? (but not, I think, plain libmatrix.obj)
Hopefully this will help you get a build. I think there will be issues dealing with the Metatrader interface, but that is the next step. I think it will also require more information.Please do not read this signature.
|
|
|
|
|
The snippets as follows:
CAboutDlg dlg;
dlg.DoModal();
Now,how to pass data to the modal dialog,for example modify the title of the modal dialog.Thx!I am not a genius, but shed more sweat!
|
|
|
|
|
Override OnInitDialog and change any values there. If you need the values to be set before instantiating the dialog then add class members and set their values when you first create the dialog object.txtspeak is the realm of 9 year old children, not developers. Christian Graus
|
|
|
|
|
You could extend the constructor of the dialog
to accept the passed parameter(s) by dialogs member(s).
As Richard said,
all visual things should be apllied at OnInitDialog() ,
as the m_hWnd is already valid,
for example:
if (m_cszPassedTitle.GetLength()) {
SetWindowText(m_cszPassedTitle);
} Check your definition of Irrationality[ ^]
1 - Avicenna
5 - Hubbard
3 - Own definition
|
|
|
|
|
The other alternative to the above suggestions, is that you define your own message, and use that to signal to your
child window that you've got some data for it.
I use the following code to pass an image to a child window.
IDC_COPYIMAGE is the message I defined. (#define IDC_COPYIMAGE 1010) There just needs to be an appropriate handler in the windowproc for the child dialog.
if (myWad.getLumpSize(myItem.iItem) == 4096)
{
flatData = (char*)myWad.loadResource(resNum, &resLen);
pal = (char*) myWad.loadResource(195, &resLen);
darkMap = (char*) myWad.loadResource(1, &resLen);
tmpImg = createImageFromFlat(flatData, pal, darkMap);
delete pal;
delete flatData;
delete darkMap;
SendMessage(imgChildHWND, IDC_COPYIMAGE, 0, (LPARAM)tmpImg);
DeleteObject(tmpImg);
}
|
|
|
|
|
I want to create a modeless dialog as main window. But I got error when calling function CreateDialog:
Unhandled exception at 0x7e424d76 in ModelessTest.exe: 0xC0000005: Access violation writing location 0x00000014.
This is my code:
BOOL CModelessTestApp::InitInstance()
{
CWinApp::InitInstance();
SetRegistryKey(_T("Local AppWizard-Generated Applications"));
CModelessTestDlg dlg;
m_pMainWnd = &dlg;
LPTSTR szAppName = MAKEINTRESOURCE(dlg.IDD);
MSG msg ;
WNDCLASS wndclass ;
memset(&wndclass, 0, sizeof(WNDCLASS));
wndclass.style = CS_HREDRAW | CS_VREDRAW;
wndclass.lpfnWndProc = ::DefWindowProc;
wndclass.cbWndExtra = DLGWINDOWEXTRA;
wndclass.hInstance = AfxGetInstanceHandle();
wndclass.hIcon = LoadIcon(IDR_MAINFRAME);
wndclass.hCursor = LoadCursor(IDC_ARROW);
wndclass.hbrBackground = (HBRUSH)(COLOR_BTNFACE + 1);
wndclass.lpszClassName = dlg.IDD_CLASS;
if (!AfxRegisterClass(&wndclass)) {
TRACE("Class Registration Failed\n");
MessageBox (NULL, TEXT ("This program requires Windows NT!"), szAppName, MB_ICONERROR);
return 0 ;
}
HWND hDlg = ::CreateDialog(GetModuleHandle(NULL), szAppName, NULL, NULL);
ShowWindow(hDlg, SW_SHOW);
while (GetMessage(&msg, NULL, 0, 0)) {
if (!IsDialogMessage(hDlg, &msg)) {
TranslateMessage(&msg) ;
DispatchMessage(&msg) ;
}
}
return FALSE;
}
The error is at this line:
HWND hDlg = ::CreateDialog(GetModuleHandle(NULL), szAppName, NULL, NULL);
But If I use the MFC way to create the modeless dialog, there is no error. For example, in above code, these codes:
HWND hDlg = ::CreateDialog(GetModuleHandle(NULL), szAppName, NULL, NULL);
ShowWindow(hDlg, SW_SHOW);
are replaced with:
dlg.Create(dlg.IDD);
dlg.ShowWindow(SW_SHOW);
HWND hDlg = dlg.m_hWnd;
it will manage to create the dialog.
Anyone know what's the cause?
Note: I'm using VC++ 2005
Thx in advance.modified on Saturday, March 6, 2010 5:13 AM
|
|
|
|
|
Your CreateDialog() call is missing some parameters; see here[^] for the description of what is required.txtspeak is the realm of 9 year old children, not developers. Christian Graus
|
|
|
|
|
Could you tell what's the missing parameter? I am totally clueless about this. I'm once thinking that I have to specify the DialogProcedure, but I saw the example from other resource (if using pure windows API way) that it doesn't need to specify the third and fourth parameter. Then I tried to provide the DialogProcedure and it still got error.
|
|
|
|
|
rudyono wrote: Could you tell what's the missing parameter?
The link I gave you clearly shows what parameters this function requires.
rudyono wrote: I am totally clueless about this.
I suggest you try something simpler; the code you posted above appears somewhat complicated. I am not sure what it is you are trying to achieve here or why you want to use a modeless dialog instead of a normal main window for your program.txtspeak is the realm of 9 year old children, not developers. Christian Graus
|
|
|
|
|
rudyono wrote: I want to create a modeless dialog as main window.
In what way are they different:
a modal dialog as main window and
a modeless dialog as main window ? Check your definition of Irrationality[ ^]
1 - Avicenna
5 - Hubbard
3 - Own definition
|
|
|
|
|
The distinction between modal and modeless dialogs is important and significant, but in your particular case of the main app window, I have to agree with Eugen Podsypalnikov that it seems to be a moot point.
I notice as well that you have written your own message loop and included it in App::InitInstance, bypassing the one provided as a part of MFC. I see no reason for you to be doing this.
I am puzzled by what you are trying to do here. It seems to me that you are writing an MFC app, but specifically bypassing MFC in it, instead nesting a win32 api application inside of it. This makes me nervous about how the various pieces of code in your app will interact.
Writing an MFC app is fine.
Writing a win32 app is fine.
I don't get what you are doing here. Perhaps you could try and clarify things for at least one of us? Please do not read this signature.
|
|
|
|
|
Here is the story, I want to make an MFC application with a splash screen. The problem is my app is a modal dialog and a modal dialog cannot startup as invisible, so that's why I was looking for modeless dialog as main window way. I was succeeded (to make modeless dialog as main window as said in my first post. It's just a curiousity that I replace the 2 line of MFC code to create a modeless dialog with win32 API code to do same thing, and it failed to create a modeless dialog. So I just want to know why the win32 API code is failed?
Btw, I already know how to solve my initial problem pertaining relationship between modal dialog and splash screen, so I had switched back to modal dialog.
|
|
|
|
|
Hi all,
i want to convert a CString value to DWORD. My problem is i am having hex value in my CString variable for ex.
CString str = 0x002C036D;
now i want to convert this value to DWORD.
How can i do this??????
Thanks in advance...
|
|
|
|
|
you can covert it to char * first,then use atoi.
Good Luck !
|
|
|
|
|
The statement
CString str = 0x002C036D; does not make much sense to me. Maybe you meant to say
CString str = _T("0x002C036D"); A simple function will do the conversion. You probably need to take a look at the function sscanf .
|
|
|
|
|
|
Hi all,
Im trying to write MJPEG frames into AVI container.
AVIStreamWrite function is getting failed.It returns the error code -2147205014.
Im not able to proceed further.
Could any one help me?
Thanks
|
|
|
|
|
|
I want to use the CHtmlEditView in my vc 6.0 project.
so i added the header file 'afxhtml.h' and then added the following line.
CHtmlEditView htmleditview_object;
then i compile the project and its giving the error like
error C2501: 'CHtmlEditView' : missing storage-class or type specifiers.
what should i do?
How do i solve this problem?sunnyram
|
|
|
|
|
ftp and gopher have related finder classes of CFtpFileFind and CGopherFileFind respectively.
but how to find files with http protocol?
is it impossible?
|
|
|
|
|
I might be talking complete rubbish, but I don't think HTTP servers support searching. I've certainly never come across a program that lets you do it, and I've come across plenty of FTP ones.
|
|
|
|
|
The HTTP protocol does not offer this. Perhaps the web server provides a search or directory service you can use.
Cheers, M
PS: If it was another user posting this question, I would not be very surprised about a followup-post describing what you want to achive and we could start a communication to discuss alternatives and find a technical a solution. But since it is includeh10 we will never know. Hope I could help anyway, see you next time.
|
|
|
|