|
_8086 wrote: But why char* doesn't work here as the return type?
Can you define what you mean by 'doesn't work'?
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
<br />
error C2059: syntax error : '__declspec(dllimport)'<br />
----------------------------
286? WOWW!
|
|
|
|
|
By the way, I'm keeping
extern "C" char* _declspec(dllimport) Test();
in a .h file.
----------------------------
286? WOWW!
|
|
|
|
|
This is just a hunch, but the declaration looks a little off. Try putting char* after the _declspec, instead of before it; that worked for me
Between the idea
And the reality
Between the motion
And the act
Falls the Shadow
|
|
|
|
|
After some tests, I found that the first 4 bytes is vptr, which is followed by data members.
Where is the run time type info?
|
|
|
|
|
Well you could use typid , and then look in the disassembly what it really does, right?
|
|
|
|
|
It's held in a separate area - it's a per-class thing, whereas instance data isn't. I suspect the vtable (which the vptr points at) contains the run-time type-info. As the other answer said, trace through the VC++ code for doing it
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
I need to configure some application variables. I have a CFormView and via menu conmstruct a simple CDialog. However, after DoModal returns TDOK I am unable to retrieve the CComboBox selection - not even the GetCount returns number of items in the CComboBox. I seldom use CDialog but this got me stumped, I am obviously missing an important piece of code.
Thanks for reading and your help is as always appreciated.
Here is the offending code:
void CFD2008View::OnConfigureSetup()
{
CString strText;
CComboBox* pCombo10;
int nIndex;
int nCount;
// verify document
if(!m_CFD2008Doc)
m_CFD2008Doc = GetDocument();
VERIFY (m_CFD2008Doc);
CDialog dlg(IDD_DIALOG1);
if (dlg.DoModal()==IDOK){
TRACE("\nvoid CFD2008View::OnConfigureSetup() ");
pCombo10 = (CComboBox *) GetDlgItem(IDC_COMBO10);
VERIFY(pCombo10);
nIndex = pCombo10->GetCurSel();
//always returns 0
nCount = pCombo10->GetCount();
// always returns 0
}
}
|
|
|
|
|
Try using
pCombo10 = (CComboBox *) dlg.GetDlgItem(IDC_COMBO10);
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
When DoModal returns, the dialog box window (and combo box) have been destroyed, so attempting to access them won't work.
Instead, you could pass a pointer to the CFD2008View into the dialog - one way is
CDialog dlg(IDD_DIALOG1);
dlg.m_pView = this;
if (dlg.DoModal()... Of course, you need to define a member variable in the dialog to hold this pointer (m_pView). Then in the view class, add member variables for the information you're trying to get. Now in the dialog's OnOK function, set the view class variable so they contain the desired information.
Note that getting the count, or a pointer to the combo box will be useless as it's going to be destroyed. If you need to know the value of a selected combo box items, you'll need to find that value in the dialog's OnOK, and set that value into the view class.
Hope that helps.
Karl - WK5M
PP-ASEL-IA (N43CS)
PGP Key: 0xDB02E193
PGP Key Fingerprint: 8F06 5A2E 2735 892B 821C 871A 0411 94EA DB02 E193
|
|
|
|
|
Thanks guys. I used both of yours advices and came up with this.
X_ConfigureDialog dlg; // derived from CDialog with IDD_DIALOG1 resource;
if (dlg.DoModal()==IDOK){
// pass dialog data to current view
// or use directly in current view
m_strBand = dlg.m_ComboBox10;
m_strMode = dlg.m_ComboBox20;
}
Conclusion
1. Do not use CDialog "directly" as local variable.
2. Derive view class variable from CDialog - I guess I should have known that.
3. Let DDX/DDV do its stuff - when DoModal completes.
It still puzzles me why dlg is valid when used as derived class. I guess MFC / C++ class hierary magic.
Thanks Vaclav
|
|
|
|
|
Hey,
When obtaining a key to decrypt a file encrypted using RC4 algorithm, CryptImportKey() fails.
The error says, "Invalid type specified".
What may be the possible reasons for this ?
It fails when I export the key in one application and import it in another application.
Has this something to do with storage of keyBLOB (I store it in a text file while exporting the key and read it from the text file while importing from a different application)?
Or is there some other reason that may lead it to failure.
Please reply at the earliest.....
Regards,
|
|
|
|
|
hi..
can i connect to the internet through c?
i prepared an application but am stuck up with the actual headers to be used..
please help
custom website design
modified on Friday, June 19, 2009 5:17 AM
|
|
|
|
|
Using internet means what? Even sending a file across n/w would mean "using internet".
----------------------------
286? WOWW!
|
|
|
|
|
C can do anything u tell it to do!!! it is probably the language that is in control of any bit of hardware u look at today.
here is a good embedded stack that is scaleable and will make your toaster TCP/IP compatible
http://www.sics.se/~adam/uip/index.php/Main_Page[^]
|
|
|
|
|
Use WinInet[^] - that's the Microsoft internet library that's C compatible that I'd use.
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
thanks a ton for this.. i wanted this..
thanksssssssssssssssssssssssssss
|
|
|
|
|
If I define the constructor of typedef struct, it will appear some error(error C4430,errorC4183). How do I solve this problem?
struct b
{
b()
{
}
b(int p1)
{
m_p1=p1;
}
int m_p1;
};
typedef struct
{
a()
{
}
a(int p1)
{
m_p1=p1;
}
int m_p1;
}a;
1>d:\windowsxpdoc\visual studio 2008\projects\t3\t3\t3dlg.cpp(156) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>d:\windowsxpdoc\visual studio 2008\projects\t3\t3\t3dlg.cpp(158) : warning C4183: 'a': missing return type; assumed to be a member function returning 'int'
1>d:\windowsxpdoc\visual studio 2008\projects\t3\t3\t3dlg.cpp(161) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>d:\windowsxpdoc\visual studio 2008\projects\t3\t3\t3dlg.cpp(163) : warning C4183: 'a': missing return type; assumed to be a member function returning 'int'
|
|
|
|
|
the type was named but struct wasn't.
typedef struct a
{
a()
{
}
a(int p1)
{
m_p1=p1;
}
int m_p1;
} aType;
|
|
|
|
|
Hi,
I need to capture the image from a window into a CBitmap. The code I have written just produces a black bitmap (correct size though )
Can anyone see what I have done wrong? The bimap is created with the correct bits/pixel (32).
CRect rect(0, 0, 100, 100);
CBitmap bmpCap;
CBitmap *pBmpOld = NULL;
CWnd* pWnd = GetDlgItem(IDC_SUCN_CHART);
pWnd->GetWindowRect(&rect);
ScreenToClient(rect);
CDC* pdcScreen = pWnd->GetDC();
CDC memDC;
BOOL bResult = memDC.CreateCompatibleDC(pdcScreen);
bResult = bmpCap.CreateCompatibleBitmap(pdcScreen, rect.Width(), rect.Height());
BITMAP bm;
bmpCap.GetBitmap(&bm);
pBmpOld = memDC.SelectObject(&bmpCap);
bResult = memDC.BitBlt( 0, 0, rect.Width(), rect.Height(), pdcScreen, rect.left, rect.top, SRCCOPY );
|
|
|
|
|
Hi,
You can call CWnd::PrintClient[^] and ask the window to draw itself into the destination device context.
CBitmap bmpCap;
CBitmap *pBmpOld = NULL;
CWnd* pWnd = GetDlgItem(IDC_SUCN_CHART);
pWnd->GetWindowRect(&rect);
ScreenToClient(rect);
CDC* pdcScreen = pWnd->GetDC();
CDC memDC;
memDC.CreateCompatibleDC(pdcScreen);
bmpCap.CreateCompatibleBitmap(pdcScreen, rect.Width(), rect.Height());
pBmpOld = memDC.SelectObject(&bmpCap);
pWnd->PrintClient(&memDC,PRF_NONCLIENT|PRF_CHILDREN);
memDC.SelectObject(pBmpOld);
pWnd->ReleaseDC(pdcScreen);
bmpCap.DeleteObject();
memDC.DeleteDC();
|
|
|
|
|
Wow thats cool
It looks like my problem was selecting the bitmap into the printer DC because it was not compatible. Using CWnd::PrintClient() should get me around this problem and its less code.
Thanks again, you have saved me hour of work trying to get thie code working.
|
|
|
|
|
Can someone help. I am not sure but I think i read about this before. I can't find it when I need it.
I am looking for anything that will help me compare 2 images of diferent sizes using VC++.
The following only tell me the sizes are different. However I already know that they are different.
BYTE image1[ImageSize];
BYTE image2[ImageSize];
if( memcmp(image1,image2,sizeof(image1)) == 0)
else
Thanks a million
|
|
|
|
|
Hi Fish,
The real question is how much accuracy do you require. If I wanted a quick and dirty image compare I would probably create a histogram of the colors[^] in both images. If you need greater accuracy then maybe you could use a library specifically designed for computer vision.
Integrating Vision Toolkit[^]
VLFeat[^]
Best Wishes,
-David Delaune
|
|
|
|
|