|
I have interfaces definitions.
I have implemented them in dll's
These dll's worked as cutom plugins. Usually they were build by msvc.
Each dll exported 3 function, GetIterfacesCLSIDS()/Create(CLSID)/Destroy(CLSID). It woked superb when both (client, plug in were buld by msvc compiler)
or both with mingw compiler.
The client now has growned and I'm using massive MFC (has lot's of gui and u knw is easy).
Now I try to build the dll's on demand (as compiled script)
and I use free gcc (g++) from (Mingw) C++ compiler and dlltool.
The dll is oj, and exported functions are called and my instances created ok.
Now I get 'ESP was not saved corectly durring a ... see the call type'
So is not the call type. As long the object imlementor of the interface is created my dll and the virtual table layout is different than the msvc.
Msvc vtable is
PObject->PVtable->[Vf1][Vf2]..[Vfk]
while
mingw vtable is
PObject->[Vf1][Vf2]..[Vfk]
So there is a missing intermdiare [PVtable] pointer there. Does any one know how to hack the calls using trunks or __asm (back and forward)
these ? Thanks
|
|
|
|
|
|
Sorry guyz...I ask another question to you.
Ok, I began studying some MFC programming with Jeff Prosise's "Programming Windows with MFC 2nd Ed." and I am blocked at the Hello World chapter.
I use his code:
HELLO.H
class CMyApp : public CWinApp
{
public:
virtual BOOL InitInstance ();
};
class CMainWindow : public CFrameWnd
{
public:
CMainWindow ();
protected:
afx_msg void OnPaint ();
DECLARE_MESSAGE_MAP ()
};
HELLO.CPP
#include <afxwin.h>
#include "Hello.h"
CMyApp myApp;
/////////////////////////////////////////////////////////////////////////
// CMyApp member functions
BOOL CMyApp::InitInstance ()
{
m_pMainWnd = new CMainWindow;
m_pMainWnd->ShowWindow (m_nCmdShow);
m_pMainWnd->UpdateWindow ();
return TRUE;
}
/////////////////////////////////////////////////////////////////////////
// CMainWindow message map and member functions
BEGIN_MESSAGE_MAP (CMainWindow, CFrameWnd)
ON_WM_PAINT ()
END_MESSAGE_MAP ()
CMainWindow::CMainWindow ()
{
Create (NULL, _T ("The Hello Application"));
}
void CMainWindow::OnPaint ()
{
CPaintDC dc (this);
CRect rect;
GetClientRect (&rect);
dc.DrawText (_T ("Hello, MFC"), -1, &rect,
DT_SINGLELINE ¦ DT_CENTER ¦ DT_VCENTER);
}
Now what I do? Simply, I create a new Win32 app, empty project and I create the two files; when I run the application I get two errors...
Compiling...
prova.cpp
Linking...
nafxcwd.lib(thrdcore.obj) : error LNK2001: unresolved external symbol __endthreadex
nafxcwd.lib(thrdcore.obj) : error LNK2001: unresolved external symbol __beginthreadex
Debug/prova.exe : fatal error LNK1120: 2 unresolved externals
Error executing link.exe.
prova.exe - 3 error(s), 0 warning(s)
HELP ME! PLEASE!
Thanx boys!
Alberto from Italy.
|
|
|
|
|
Solution is simple:
In project properties select --> c++ --> code generation,
then in Run time library select Multi thread debug.
Cheers,
|
|
|
|
|
|
I have grown accustomed to use CObArrays in my applications, and I often have quite a few. For serialization I find them particularly easy to use.
But one thing worries me, it is as far as I can see not possible to use functions like reserve() and capacity() that the STL vector class have. In MSDN it is recommended to use SetSize(), but I have no idea at compile time how many items there will be in the arrays.
Does this mean that the pointer array is copied every time an Add() is carried out? That will result in memory looking very much like Swiss cheese at the end. MSDN speaks of default block size, but I can not find out what that is. Don't know how big this problem is in practice.
Regards, Haakon S.
A sure cure for seasickness is to sit under a tree.
Spike Milligan
|
|
|
|
|
Haakon S. wrote:
But one thing worries me, it is as far as I can see not possible to use functions like reserve() and capacity() that the STL vector class have.
That would be because the MFC container classes are crap.
Haakon S. wrote:
Does this mean that the pointer array is copied every time an Add() is carried out?
Dunno, I shun the MFC containers. But I do know that all the MFC source code is on your hard drive, it's installed with VC. So it should be easy to find out.
Christian
I have drunk the cool-aid and found it wan and bitter. - Chris Maunder
|
|
|
|
|
I was looking at some sites that gets your IP and gives you your geographic location. I am wondering how do they do that? Anyone has any idea?.
Look at this site as an example: http://www.geobytes.com/IpLocator.htm?GetLocation
Danke,
|
|
|
|
|
Short answer: Databases. Big honkin' databases of location information for different hosts and networks.
There's also the little-used LOC field on DNS entries.
You can download an old (circa 1998) database (in text format) here:
http://www.dtek.chalmers.se/~d3august/xt/dl/[^]
It's the "ndg_files.tar.gz" archive, provided by the Xtraceroute[^] author.
- Mike
|
|
|
|
|
Yep, as a previous post had mentioned, it uses a big database with the information in it, and performs queries looking for the IP address.
The product that GeoBytes offers that does this is called GeoNetMap. It's $49 for a developers license so you can get some code down and so on for your own website. Then they charge different commercial prices depending on the number of queries per day. (For instance 10,000 queries a day cost $500 a year).
I've looked at the code for it and it is very simple code to incorporate it for your own website if you are interested. ASP, PHP, PERL (and I think Java) are some of the languages that they provide examples for.
|
|
|
|
|
I have some software that communicates over a serial port. It opens the serial port with the usual ::CreateFile() call and works fine in the following circumstances:
1) The computer has a real serial port that I am opening
2) The computer has a real serial port, but the serial port I'm opening is one hanging off a serial-to-USB or -to-PCMCIA converter
What does NOT work SOMETIMES is the exact same code running on a computer that does not have a real serial port, where I am trying to open a serial port on a serial-to-USB or -to-PCMCIA converter. When the open fails, it tells me that it could not create the file.
What could cause the failure? It seems to have to do only with whether the computer has a real serial port, not with whether the serial port I'm opening is a real one or one hanging off a converter.
Thanks
|
|
|
|
|
I have found the answer already, so no need to reply. If anyone is interested, the answer is that the "fake" serial ports must be opened by calling ::CreateFile() with a string like "\\.\COM5", instead of just "COM5". The latter will work if the computer has a native serial port, but won't if it doesn't.
|
|
|
|
|
Hi.
I want to sending information from DOS(Real Mode) to windows app.
I don't want to use shared folders. i want my app in dos(Real Mode) sending information to another app that i was wrote in windows.
this is very important to me.
Thanks.
|
|
|
|
|
hmmmm, ur message doesnt make sense...
when u run a DOS app in windows, it doesn't run in real mode, it is just emulated.
i've never heard about a DOS<->windows communication... i would use a shared folder, cause all the other synchronisations like named pipe, event, mutex etc are not accessable from a dos app.
u could try to check network, i don't know if this could work!
good luck,
Alexander M.
Don't try it, just do it!
|
|
|
|
|
In windows 98, at the A: you can type c:\win to fire up windows.
What is the command for Windows 2000 ???? (from the A: prompt)
Any help appreciated
George W
Software Developer
www.zsystems.ca
|
|
|
|
|
Hello,
It does not possible boot from dos command prompt like windows 98.
With Regards,
R.Selvam
|
|
|
|
|
Hi all guys!
I'm programming Windows with Visual C++ (6.0) for my first time; i created an applicatio, with a simple menu and an ABOUT BOX dialog; well, now the problem is that I want to add also an icon. So I go to Insert -> Resource -> Icon and I drive my one. Then in the code I use:
wndclass.hIcon = LoadIcon (NULL, MAKEINTRESOURCE(IDI_ICON1)) ;
Ok then. I start my app...but I see a normal Win icon not mine!
What's the problem?
Alberto
|
|
|
|
|
The easiest way to do this is to remove the icon that AppWizard created for you, copy the desired icon to the Res folder, and rename it to what the original one was, recompile.
A rich person is not the one who has the most, but the one that needs the least.
|
|
|
|
|
The first paramter to LoadIcon() needs to be a valid module handle, the handle of your EXE, which is passed as the first param to WinMain() .
--Mike--
Ericahist | CP SearchBar v2.0.2 | Homepage | 1ClickPicGrabber New v2.0! | RightClick-Encrypt
Kosh reminded me of some of the prima-donna programmers I've worked with. Knew everything but when you asked them a question; never gave you a straight answer.
-- Michael P. Butler in the Lounge
|
|
|
|
|
Is it just the application icon at the top of the screen you wish to change?
Simplest way is to redraw the IDR_MAINFRAME icon that already exisits in your application. You also will want to change both 32x32 and 16x16 pixel diagrams.
What is beyond the universe?
|
|
|
|
|
I inserted the same icon in an ABOUT BOX dialog and when I open it, I see only the ERROR icon from Windows...
|
|
|
|
|
Still not sure I follow what you mean.
Is your project a SDI or MDI or Dialog application?
What are you trying to do, change the icon or add more icons?
If you are just trying to change what the icon looks like generally you dont need to change any code.
What you have to do is:
1) go to the "Workspace" window (if not there bring it up by RIGHT clicking on the VC++ menu toolbar and selecting workspace"
2) click on the "ResourceView" tab.
3) Find IDR_MAINFRAME in the directory tree and double click.
4) Edit the icon using the paint like editor that comes up.
5) At the top of the editor switch to the other icon size 16x16 by selecting in the "Device" combobox and edit this icon also.
6) Build your application and check changes.
Also you can change the about box ICON (again no code) by:
1) Bring up the dialog about box in the dialog editor.
2) Right click on the picture box containing the icon.
3) select "Properties from the menu that pops up.
4) Selet the "General" tab if not already selected.
5) Change the "Image:" combobox selection to the Icon that you have created.
6) build you app and check
Hope that helps.
Divide and conquer is generally the best way to beat a problem.
|
|
|
|
|
|
I have an mdi aplication with 3 difernt views.
view1
view2
view3
Let say that the active view is view2. How can i make view3 the active view???
|
|
|
|
|
void CFrameWnd::SetActiveView(
CView* pViewNew,
BOOL bNotify = TRUE
)
|
|
|
|