|
Mike,
Indeed, I can't change the caller so I've used the GetActiveWindow API and this provides me what I was looking for.
Merci beaucoup de ton aide ( j'ai lu sur ton site web personnel que tu as étudié le français ... alors je ne peux résister )
Marc
|
|
|
|
|
Hi..
I used the ADO data bound Dialog wizard to use an access DB table (ID:Autonumber , title:text , description:MEMO)
this code adds a new record:
UpdateData();
_variant_t varIndex;
_variant_t varVal;
try
{
m_pRs->AddNew();
varIndex.vt=VT_I4;
varIndex.lVal=1;
varVal.vt=VT_BSTR;
varVal.bstrVal=m_strDlgTitle.AllocSysString();
m_pRs->Fields->GetItem(varIndex)->PutValue(varVal);
varIndex.lVal=2;
::SysFreeString(varVal.bstrVal);
varVal.bstrVal=m_strDlgDescription.AllocSysString();
m_pRs->Fields->GetItem(&varIndex)->PutValue(&varVal);
::SysFreeString(varVal.bstrVal);
vtMissing;
m_pRs->Update(vtMissing,vtMissing);
RefreshBoundData();
}
catch(_com_error &e)
{
AfxMessageBox(e.Description());
}
::SysFreeString(varVal.bstrVal);
the code works fine (the new data shows up in the access DB)
the problem is :
when i call RefreshBoundData the dialog refreshes only the textox that shows the ID (autonumber) while other fields (text,memo) appear empty ..
the code of RefreshBoundData is :
void CRsCgDlgCat::RefreshBoundData()
{
if (adFldOK == lIDStatus)
m_lDlgID = m_lID;
else
m_lDlgID = 0;
if (adFldOK == lTitleStatus)
m_strDlgTitle = m_wszTitle;
else
m_strDlgTitle = _T("");
if (adFldOK == lDescriptionStatus)
m_strDlgDescription = m_wszDescription;
else
m_strDlgDescription = _T("");
UpdateData(FALSE);
}
i found that the problem is : lTitleStatus,lDescriptionStatus are equal to 3 (means that they are nulls !!!)
can u help ?
please send any Qs if my post is not clear
|
|
|
|
|
I'm making a program that sorts fractions, but when I run my program my sort_ratios function is never called. What gives? I'm using c++ on windows xp if that helps.
TIA
Code:
<br />
#include <stdio.h><br />
#include <stdlib.h><br />
#include <math.h><br />
#include <ctype.h><br />
#include <string.h><br />
<br />
typedef int ratio;<br />
ratio num[100][2];<br />
int ct;<br />
<br />
void get_ratios();<br />
void sort_ratios();<br />
int cmp(ratio *, ratio *);<br />
void swap(ratio *, ratio *);<br />
void print_ratios();<br />
<br />
int main()<br />
{<br />
get_ratios();<br />
sort_ratios();<br />
print_ratios();<br />
return 0;<br />
}<br />
<br />
void get_ratios()<br />
{<br />
for(ct = 0;scanf("%d /%d", &num[ct][0], &num[ct][1])!=EOF<code> ;++ct);
}
void sort_ratios()
{
int i, j;
printf("sort ok");
for(i=0;i<ct-1;++i)
for(j=i+1;j>0 && cmp(num[j-1], num[j])>0;--j)
swap(num[j-1], num[j]);
}
int cmp(ratio a[], ratio b[])
{
return a[0]*b[1]-a[1]*b[0];
}
void swap(ratio a[], ratio b[])
{
int temp;
temp=a[0];
a[0]=b[0];
b[0]=temp;
}
void print_ratios()
{
int i;
for(i=0; i<ct; ++i){
printf("%d="" %d="" ",="" num[i][0],="" num[i][1]);
if(i="=12)
putchar('\n');
}
}
</code">
|
|
|
|
|
Is scanf supposed to be fscanf perhaps?
My neighbours think I am crazy - but they don't know that I have a trampoline. All they see my head bobbing up and down over the fence every five seconds
|
|
|
|
|
|
I'm trying to convert this VB line
Dim hWndp As Long<br />
hWndp = WindowFromPoint(Pt.X - 5, Pt.Y - 5)
into C++... any help please?
Thanks,
Mike
|
|
|
|
|
MSDN:
static CWnd* PASCAL WindowFromPoint( POINT point );
So your C++ code should be:
CWnd* hWndp = WindowFromPoint( CPoint(Pt.x - 5, Pt.y - 5) );
|
|
|
|
|
POINT Pt;
HWND hWndp;
POINT Pt2 = Pt;
Pt2.x -= 5;
Pt2.y -= 5;
hWndp = WindowFromPoint ( Pt2 );
--Mike--
Ericahist | CP SearchBar v2.0.2 | Homepage | RightClick-Encrypt | 1ClickPicGrabber
There is a saying in statistics that a million monkeys pounding on typewriters would eventually create a work of Shakespeare. Thanks to the Internet, we now know that this is not true.
|
|
|
|
|
The first time i call EncryptString (below) I pass "<password>asdf" it encrypts to to be a length of 25 and encrypts it right. But when i try to encrypt a 2539 length string it returns a string of a length of 225 and only partically encrypted. Why is this happening and how do I fix it?
CString CEncyptionClass::EncryptString(CString m_strUnencryptedString)
{
//variables
//Date:11 22 03
CString m_strResultingText;
HCRYPTPROV hProv = NULL;
HCRYPTKEY hKey = NULL;
HCRYPTHASH hHash = NULL;
DWORD dwLength;
BYTE * pbBuffer;
LPTSTR m_tContents=ConvertCStringToChar(m_strUnencryptedString);
TCHAR szLocalPassword[] = _T("alongrandompassword");
//
// Get handle to user default provider.
if (CryptAcquireContext(&hProv, NULL, NULL, PROV_RSA_FULL, 0))
{
// Create hash object.
if (CryptCreateHash(hProv, CALG_MD5, 0, 0, &hHash))
{
// Hash password string.
dwLength = _tcslen(szLocalPassword);
if (CryptHashData(hHash, (BYTE *)szLocalPassword, dwLength, 0))
{
// Create block cipher session key based on hash of the password.
if (CryptDeriveKey(hProv, CALG_RC4, hHash, CRYPT_EXPORTABLE, &hKey))
{
dwLength= _tcslen(m_tContents);
pbBuffer=(BYTE*)malloc(dwLength);
if (pbBuffer != NULL)
{
memcpy(pbBuffer, m_tContents, dwLength);
if (CryptEncrypt(hKey, 0, true, 0, pbBuffer, &dwLength, dwLength))
{
m_strResultingText.Format("%s",pbBuffer);
CString strShow;
strShow.Format("After: %s \r\n(%s)\r\n %d %d", m_strResultingText,m_tContents,strlen((const char*) pbBuffer) ,dwLength);
MessageBox(strShow);
}
free(pbBuffer);
}
CryptDestroyKey(hKey); // Release provider handle.
}
}
CryptDestroyHash(hHash); // Destroy session key.
}
CryptReleaseContext(hProv, 0);
}
return m_strResultingText;
}
-Steven Hicks
CPACodeProjectAddict
|
|
|
|
|
I am tring to build a keyboard hook that blocks the
windows keys. It has to be in a seperate dll. The
call to SetWindowsHookEx requires a HINSTANCE to the
dll. How do I get an HINSTANCE to my dll with out
having to use CWinApp. There is way more stuff in the
CWinApp class than I would like to use.
class CTaskKeyHookDll : public CWinApp
{
public :
CTaskKeyHookDll(){ }
~CTaskKeyHookDll(){ }
} MyDll;
class CTaskKeyHookDll
{
public :
HINSTANCE hInstance;
CTaskKeyHookDll(){ }
~CTaskKeyHookDll(){ }
} MyDll;
Anyone know how to do this?
Thank You
Bo Hunter
|
|
|
|
|
in your overridden DllMain() save the first parameter(HINSTANCE) to g_hInstance.
|
|
|
|
|
I am using a textfile assocciated with my file to store all my data that has resulted from my program, though I have and know know how to record things, I need help in retreiving and analyzing data from the txt file. Can anyone help? I need to look for a specific string of numbers then go to end of the line and retrieve the last character, can someone please help me acheive this, I am using win32.
|
|
|
|
|
Have you thought of a ini file?
If so there is so much code on this site for store and retrieve data.
Best Wishes and Happy Holiday's,
ez_way
|
|
|
|
|
Is there anything special about ini files
|
|
|
|
|
Hi
Sure they take all the work out of acc. a text doc.
See class
http://www.codeproject.com/useritems/CIni.asp?target=cini
and
http://www.codeproject.com/useritems/hongky.asp?target=cini
Best Wishes and Happy Holiday's,
ez_way
|
|
|
|
|
I have a MFC program which supports Documents but I want my program to start with multiple documents.
How could it be possible?
Earth is like an apple, where are worms in it - the worms are humans...
|
|
|
|
|
I guess if you call OpenDocument as many times that many document window and view will be opened.
IndrekSnt wrote:
Earth is like an apple, where are worms in it - the worms are humans...
IndrekSnt wrote:
where are worms in it
Is it a question or a statement?
|
|
|
|
|
BOOL CGLprMpDoc::OnNewDocument()<br />
{<br />
if (!CDocument::OnNewDocument())<br />
return FALSE;<br />
<br />
<br />
return TRUE;<br />
}
What do I have to write between lines:
// (SDI documents will reuse this document)
and:
return TRUE;
---
Earth is like an apple, where are worms in it - the worms are humans...
|
|
|
|
|
errrrrrr
to open multiple documents u need to be writing an MDI app
MDI = multiple document interface
SDI = single document interface
"there is no spoon" biz stuff about me
|
|
|
|
|
This may be a little off the wall but you might want to think about the benefits of using Forth. It is a fine training language and will allow you to master the concept of object oriented thinking and open many possibilities for you.
My neighbours think I am crazy - but they don't know that I have a trampoline. All they see my head bobbing up and down over the fence every five seconds
|
|
|
|
|
Kidding
My neighbours think I am crazy - but they don't know that I have a trampoline. All they see my head bobbing up and down over the fence every five seconds
|
|
|
|
|
Hmm, I started a MFC MDI project but I don't know how to customise it more than MFC MDI wizard allows...
---
Earth is like an apple, where are worms in it - the worms are humans...
|
|
|
|
|
Hello all
I need information how verify (hash data and signature) this function.
I get data from hash by using CryptGetHashParam(...)and send to
SmartCard (infineon). This card prepare digital signature.
Next step call CryptVerifySign(...) for this signature and hash but receive error - bad signature.
What's wrong ?
Thanks
Adam Lyzwinski
Alyan
|
|
|
|
|
hi,
my application uses crystal report ocx and take setup for with application using .net setup wizard. while intalling the application on pc i got the following error
Module C:\wINNT\System32\crystl32.occx failed to register. HRESULT -2147024770 Contact your support personnel.
any one help to me.
thanks in advance.
|
|
|
|
|
That means a dependent module (DLL or OCX) wasn't installed. Run 'depends' on the OCX and see what might be missing.
Steve S
|
|
|
|