|
I have a VC project built by VC6 was a MFC app format.
Last year, someone convert it to MFC DLL format and I have to turn it backup, now!
I used VC2008 + sp1 do it, but I got a warning:
Linker Tools Warning LNK4086: entrypoint '_wWinMainCRTStartup' is not __stdcall with 12 bytes of arguments; image may not run.
How to overcome it ?
Best Regard!
|
|
|
|
|
Without seeing the code, it's hard to say what the problem is.
If you can't figure this out, maybe you should consider creating an empty MFC app, and then adding the code from the DLL, piece by piece.
|
|
|
|
|
Hi, Hans
THX
ye, after I pieced code from the DLL, I got a lot of "error LNK2001" and "error LNK2019"
Very peculiar, the Dll project didn't import any libs !?
|
|
|
|
|
Post errors here if you need help.
|
|
|
|
|
error LNK2019: unresolved external symbol "public: void __thiscall CHdtaVwRenderThread::AddJobW(int,int,class CSize const &,struct CHdtaVwDisplaySettings const &,int)" (?AddJobW@CHdtaVwRenderThread@@QAEXHHABVCSize@@ABUCHdtaVwDisplaySettings@@H@Z),the symbol called in function "protected: void __thiscall CHdtaVwBaseView::UpdatePageCache(int,class CRect const &,bool)" (?UpdatePageCache@CHdtaVwBaseView@@IAEXHABVCRect@@_N@Z)
error LNK2001: unresolved external symbol "__declspec(dllimport) public: __thiscall PageInfo::~PageInfo(void)" (__imp_??1PageInfo@@QAE@XZ) dtaVwBaseView.obj
Best Regard.
|
|
|
|
|
OK, none of these are MFC or Windows APIs. You're going to need to track down where CHdtaVwRenderThread , CHdtaVwBaseView , and PageInfo are located. Look at the .dsp (or .vcproj) file of the DLL (open in regular text editor). Search for these names, or for 'hdta'. The DLL must be linking with these APIs somehow. Also, search your HD for 'hdta*'. If you're able to compile and build the DLL on your system, they must be there someplace. In particular, look at any include directories or lib directories that the DLL links to.
|
|
|
|
|
HI, Hans
I have solved the problem after I erased the word "AFX_EXT_CLASS" before CHdtaVwRenderThread!
Thank you for your help again.
Best wishes.
|
|
|
|
|
The following code results in a Build Error error LNK2001: unresolved external symbol _IID_IDirectSoundBuffer8 if I un-comment the 5th line:
hr = pDirectSoundBuffer->QueryInterface(IID_IDirectSoundBuffer8, (LPVOID*) ppDirectSoundBufferInterface);
I've added Dsound.lib to the Additional Dependencies for the Linker in this project.
I've included Dsound.h which has the definition of IID_IDirectSoundBuffer8 in my .cpp file, so it should know all about the GUID Definition.
Why has it pre-pended an underscore in the Build Error message (i.e. "_IID_IDirectSoundBuffer8")? I don't have one in my code. I used "IID_IDirectSoundBuffer8".
hr = lpDirectSound->CreateSoundBuffer(&dsbDescription, &pDirectSoundBuffer, NULL);
if(SUCCEEDED(hr))
{
pDirectSoundBuffer->Release();
}
With the offending line commented out as above, the code builds ok and runs. Putting in a break-point and investigating the various values just prior to the offending line I have the following:
hr = S_OK ......So it apparently created the Secondary Buffer Ok
pDirectSoundBuffer.IUnknown.__vfptr[0] = 0x73f5d348
pDirectSoundBuffer.IUnknown.__vfptr[1] = 0x73f38f8c
pDirectSoundBuffer.IUnknown.__vfptr[2] = 0x73f19105
dsbDescription.dwSize = 36
dsbDescription.Flags = 32960 (i.e. DSBCAPS_CTRLPAN | DSBCAPS_CTRLVOLUME | DSBCAPS_GLOBALFOCUS)
dsbDescription.dwBufferBytes = 5930
dsbDescription.dwReserved = 0
dsbDescription.lpwfxFormat.wFormatTag = 1
dsbDescription.lpwfxFormat.nChannels = 1
dsbDescription.lpwfxFormat.nSamplesPerSec = 11025
dsbDescription.lpwfxFormat.nAvgBytesPerSec = 11025
dsbDescription.lpwfxFormat.nBlockAlign = 1
dsbDescription.lpwfxFormat.wBitsPerSample = 8
dsbDescription.lpwfxFormat.cbSize = 0
dsbDescription.guid3DAlgorithm = {GUID_NULL}
All values in dsbDescription correlate with what we should see for the selected Wave file.
The QueryInterface method is supposed to retrieve a pointer to the interface for my object.
i.e. it's supposed to fill the pointer ppDirectSoundBufferInterface with the correct pointer address for the DirectSound Buffer Interface of my new DirectSoundBuffer object.
Any clues at to why this Build Error occurs would be most appreciated.
Thank you in advance
Paul.
modified on Friday, April 15, 2011 11:25 AM
|
|
|
|
|
Take a look at the header file dsound.h and check that it is defining the correct version thus:
#define DIRECTSOUND_VERSION 0x0800 /* Version 8.0 */
|
|
|
|
|
Thanks for your response Richard.
Below is the definiton in Dsound.h
I'm running XP PRO SP3 on this old laptop so it will be defining DirectSound Version 9.0
My understanding was that this was still based on the DirectSound8 interfaces etc.
Have I miss-understood? I'm only just starting to learn DirectSound, so that's highly likely.
#ifndef DIRECTSOUND_VERSION
#if (NTDDI_VERSION < NTDDI_WINXP) /* Windows 2000 */
#define DIRECTSOUND_VERSION 0x0700 /* Version 7.0 */
#elif (NTDDI_VERSION < NTDDI_WINXPSP2 || NTDDI_VERSION == NTDDI_WS03) /* Windows XP and SP1, or Windows Server 2003 */
#define DIRECTSOUND_VERSION 0x0800 /* Version 8.0 */
#else /* Windows XP SP2 and higher, Windows Server 2003 SP1 and higher, Longhorn, or higher */
#define DIRECTSOUND_VERSION 0x0900 /* Version 9.0 */
#endif
#endif // DIRECTSOUND_VERSION
|
|
|
|
|
Well you need to see which one of these is actually enabled to check whether it's generating for 7, 8 or 9. If you open this in Visual Studio you should see two of them grayed out and one in normal definition which is the value being used by the compiler. I just checked on my system (Windows 7) and it uses 0x0800 which should build correctly.
|
|
|
|
|
Yes it's using DirectSound Version 9. The other's are grayed out.
However it's still my understanding that there is no IID_IDirectSoundBuffer9 etc. It's all still based on DirectSound8. Is this not the case?
The following line in Dsound.h is not grayed:
DEFINE_GUID(IID_IDirectSoundBuffer8, 0x6825a449, 0x7524, 0x4d82, 0x92, 0x0f, 0x50, 0xe3, 0x6a, 0xb3, 0xab, 0x1e);
I'm still also confused why the Build Error talks about _IID_IDirectSoundBuffer8 when neither I or my dog ever mentioned anything starting with an underscore.
Currently trying to modify the nearest large vertical surface by craniofacial means.
Thanks again for your responses. Your input is really appreciated.
|
|
|
|
|
The leading underscore is put there by the compiler and the actual value should be found in the Dsound3d.lib file. If you do not have that (and its corresponding DLL) on your system then you need to get a copy of Directx8 libraries; some more info here[^].
|
|
|
|
|
Hello,
i need to copy multiple selection to clipboard from my CListCtrl.
Now is that ctrl+c copy only the first selected item from my CListCtrl, but not the rest!
How to catch ctrl+c key's???
thanks for any help!
Arrin!
|
|
|
|
|
You can derive your own CMyListCtrl from CListCtrl and handle the WM_KEYDOWN or WM_CHAR messages. Then loop over the selected rows and accumulate them in a CString variable, appending CR/LF to each row (maybe also putting a TAB between columns). Finally, copy the CString variable to the clipboard.
|
|
|
|
|
Hello,
sorry for late answer, thanks for help!
Your idea works!
Regards
Arrin
|
|
|
|
|
Hi all,
I am implementing a GUI. I need a ListControl or GridControl that it allows to add any other controls on it.
Example: i want to add a ProgressBar into a cell, like FireFox's Download Manager
or i want to create a gallery control to display the image item, like the good sale web page.
|
|
|
|
|
|
Additionally, check out The Ultimate Grid Home Page[^].
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> //TODO: Implement signature here<
|
|
|
|
|
I just have those questions about those code snippets from the C++ GUI Programming with Qt 4 book:
GoToCellDialog::GoToCellDialog(QWidget *parent):QDialog(parent)
Does that mean we are inheriting QDialog(parent)? Or, what exactly does this mean?
setupUi(this);
Here, this code snippet is part of the gotocelldialog.cpp file, which is the implementation of gotocelldialog.h header file. What do we mean by this in this context? What are we trying to setup? And, what kind of setup will that be?
Thanks.
modified on Friday, April 15, 2011 4:11 AM
|
|
|
|
|
GoToCellDialog::GoToCellDialog(QWidget *parent) : QDialog(parent)
This is a constructor making use of the initialiser list (the part following : ) to intialise its base/parent.
GoToCellDialog probably is declared something like:
class GoToCellDialog : QDialog { ... };
The initialiser list is a way for constructors to initialise member variables and also call the parent constructor.
The code above would be 'equivalent' to:
GoToCellDialog::GoToCellDialog(QWidget *parent)
{
QDialog(parent);
...
}
What setupUi does I'm note sure, beyond what it's name says: setting up the UI.
|
|
|
|
|
Thanks for your reply. In the setupUi part, I specifically just want to now what this refers to.
modified on Thursday, April 14, 2011 8:03 AM
|
|
|
|
|
This is the pointer to the object you are currently 'in'.
Take for instance this program:
class A
{
int a;
int func()
{
return this->a;
return a;
}
};
class B : A
{
int b;
int funcB()
{
return this->b;
return b;
return this->a;
return a;
}
}
int main()
{
}
class C
{
int c;
static sc;
static int funcC()
{
return sc;
return this->sc;
return this->c;
}
}
So, to summarise: 'this' is a pointer in a class to itself (with itself is meant: the current instance).
|
|
|
|
|
Thanks for your reply and nice example.
The point I want to ask about here is when you mention "instance of a class". Like when you said "this refers to an instance of of A", and the you use return this->a; . But, why is a considered an instance of class "A"? Doesn't instance mean an object of class "A"? In other words, of type "A"? And, here, "a" is of type int .
Can you just clarify this point?
Thanks.
|
|
|
|
|
What I was referring to is that "the 'this' keyword refers to an instance of class A".
Sort of like A* this . When you then want the value of int a for that instance, you dereference the pointer and access a: this->a .
But because the compiler is smart, it'll also understand what you want if you simply write 'a' and omit the 'this->' part.
The reason I used a bit more confusing way of saying it (maybe), is that I wanted to make clear distinction between the class A and an instance of class A.
This distinction particularly comes into play when statics are involved (the telling difference is that there is no 'this' in that case, because you're not talking about instances of A when you're inside a static function using static variables).
Hope this makes it more clear. If not, feel free to ask more questions
|
|
|
|