|
I give the user a chance to pick a bmp file with cFileDialog. In the event he cancels out, I want to put some sort of non-null identifying entry into the database field where the blob was supposedto be stored. Now if this were a text field, I'd just put in a "_" if my entry was an empty string. But here, what shal I put into the field (access type Ole Object) That way when I go to read this field, if I see my identfying entry I can exit gracefully without further processing and an appropriate messagebox.. I hope my dilemma is clear to you. Plesae let me know if you have any ideas.
Thanks,
ns
|
|
|
|
|
Can't you just use null (in the relational DB sense)?
Tomasz Sowinski -- http://www.shooltz.com
"Yields falsehood when preceded by its quotation" yields falsehood when preceded by its quotation.
|
|
|
|
|
How would I recognize it when i went to read it out? I know my stuff crashes if I have blank entries in my database for text, so I had to resort to "" replaced by "_". The db doesnt quite like me to say
rs->fields("A")->value = NULL (putting in data)
and
if (rs->fields("A")->value == NULL) DoSomething(); getting out data.
Thats also because the db I created in code does not allow zero length entries simply because I didnt find the commnad to make it do so.
ns
|
|
|
|
|
It seems your DB experience is extremely thin
One of major concepts in databases are null values. This has nothing to do with C/C++ NULL pointer. Null value designates something which is unknown/not present. SQL provides special operators, like "IS NULL" or "IS NOT NULL", because you can't compare things with NULL.
Your example with "_" as special string is ideal candidate for using null values, as is the blob situation.
How do you set/check for null values in ADO? I don't know; it's been few years since I've coded last database app, and I was using OLEDB (ADODB underlying technology).
Tomasz Sowinski -- http://www.shooltz.com
"Yields falsehood when preceded by its quotation" yields falsehood when preceded by its quotation.
|
|
|
|
|
I have created a fairly simple "database" program for a friend of mine - it uses an Access database, and ADO to connect the user interface (created with VC++ 6.0) with it. I have deployed this app on a variety of test machines, and it worked perfectly on each one.
However, it does not work on my friend's machine! The app simply does not "connect" with the database - there are no errors, but it doesn't retrieve any data whatsoever. The machine in question is running Windows 98 First Edition, and he doesn't have Access installed (not normally a problem). The Access Drivers installed were version 3.5, so I upgraded them using MDAC 2.1 to ver 4.0. That hasn't solved the problem....
Has anyone else had this hassle? Is it actually the Access driver version cauing the problem, or is it something else? PLEASE help!
|
|
|
|
|
www.microsoft.com/data[^] has the necessary downloads. Look for Jet4 SP3 in 'Downloads' section.
Tomasz Sowinski -- http://www.shooltz.com
"Yields falsehood when preceded by its quotation" yields falsehood when preceded by its quotation.
|
|
|
|
|
I'm trying to send in a CTreeCtrl into a dialog member function from CMainFrame. I get an error back saying:
cannot convert parameter 1 from 'class CTreeCtrl' to 'class CTreeCtrl'
No copy constructor available for class 'CTreeCtrl'
In addition to my dialog class and MainFrm.h, I have the following included:
#include <windows.h>
#include <afxwin.h>
#include <afxcmn.h>
My prototype seems to match the function implementation. Any clues?
Thanks
BW
{insert witty/thought-provoking saying here}
|
|
|
|
|
try passing a pointer or reference to the CTreeCtrl...
void CClass::Whatever(CTreeCtrl &tree)
-c
Though the cough, hough and hiccough so unsought would plough me through,
enough that I o'er life's dark lough my thorough course pursue.
--Stuart Kidd
|
|
|
|
|
multi-tier architecture
hi, newbie in this... everything we code today should be packaged in components - COM (QUESTION 1: did .NET just changed this all? can we just wrap everything up in dll as Windows Service). these COM packages can communicate via:
(a) sockets, u can wrap data in XML...
(b) simple in-process local COM server (dll)
OR
simple out-of-process local COM server (exe)
(c) DCOM
QUESTION 2: now, how can i decide which technology is appropriate? of course, sockets only send "data". it doesnt invoke any service. If u need to invoke something that has NOT been previously initiated, u must resort to COM/DCOM...
thanx!
|
|
|
|
|
How can I assure if some font exist in the system?
CFont::CreateFont(...,lpszFaceName) always returns TRUE, although the lpszFaceName is fabricated! How can I validate this???
I thought maybe use Find/LoadResource() , but I don't know in which module I find those diiiamn fonts.
Help me, while sanity is on my side...
--BlackSmith--
"With the help of all mighty", 2001, Me.
|
|
|
|
|
The CreateFont function does not create a new Windows GDI font. It merely selects the closest match from the fonts available in the GDI’s pool of physical fonts.
from msdn ... meaning that the non-failure of the CreateFont() function is intended ... a font nearest to what you requested is always made available
if you want a specific font (bad bad bad) then you should make it part of your installer program
"... and so i said to him ... if it don't dance (or code) and you can't eat it either f**k it or throw it away" sonork: 100.18128 8028finder.com
|
|
|
|
|
BlackSmith wrote:
How can I validate this???
Check EnumFontFamiliesEx API.
Tomasz Sowinski -- http://www.shooltz.com
"Yields falsehood when preceded by its quotation" yields falsehood when preceded by its quotation.
|
|
|
|
|
Hello,
I posted on this yesterday, but I am still having trouble.
I am using this code:
<br />
if(!CryptAcquireContext(&hCryptProv, NULL, MS_DEF_PROV, PROV_RSA_FULL, 0))<br />
{<br />
HandleError("Error during CryptAcquireContext.");<br />
return -4;<br />
}
to aquire a handle to the Default CSP. Handle error goes like this:
<br />
void CFPCommonFunctions::HandleError(CString strFunction) <br />
{ <br />
CString strMsg;<br />
strMsg.Format("CFPCommonFunctions::EncryptTransFile() - %s: %u.", strFunction, GetLastError());<br />
AfxMessageBox(strMsg, MB_OK | MB_ICONEXCLAMATION);<br />
}
which returns the error 80090019 (I dont think this is formatted correctly by my function because I cant find this error in the Windows list)
I have no problems on my Win2000 machine, nor do I have a problem on my Win98 machine that has VS6 installed.
My beta users are getting this error every time, and when I try it on a fresh Win95 OSR2 install I get the error as well.
MSDN says this is compatible with Win95 OSR2 and later.
Can anybody see where I am going wrong???
Thanks
|
|
|
|
|
esapp420 wrote:
which returns the error 80090019
This error means: 'The keyset is not defined.'
By default CryptAcquireContext() will use keyset based on the user name and it does not exist automatically. Therefore your very first call on the new machine should contain CRYPT_NEWKEYSET within the flags.
I would also recommend to check if there is required provider installed on the target machine.
Martin
--------------------------------------------
C'mon we all know computers are experimental devices and should only be used for playing games.
Using them for alternative stuff like business, is clearly not using them for what they are intended.
Colin Davies
|
|
|
|
|
And another thing, here is the Mailing List Archives of CryptoAPI@DISCUSS.MICROSOFT.COM where you can more information specific to CAPI than here.
Martin
--------------------------------------------
C'mon we all know computers are experimental devices and should only be used for playing games.
Using them for alternative stuff like business, is clearly not using them for what they are intended.
Colin Davies
|
|
|
|
|
Thank you! This is exactly what I was looking for.
Miami is going down! 08/07/2002 Welcome to the SWAMP baby!
|
|
|
|
|
OK, things are going better, but still having trouble.
After modifying my code in accordance with the above mentioned advice, I no longer have a problem with CryptAquireContext.
Now I have a problem with this:
<br />
if(!CryptDeriveKey(hCryptProv, ENCRYPT_ALGORITHM, hHash, KEYLENGTH, &hKey))<br />
{<br />
HandleError("Error during CryptDeriveKey.");<br />
return -7;<br />
}<br />
returning error 2148073481 (Invalid Flags Specified). The only Flag param is the 4th.
KEYLENGTH is defined as 0x00800000 at the top of my file for 128-bit encription key,
and ENCRYPT_ALGORITHM is defined as CALG_RC4.
I am giving it a valid hCryptProv and a valid hHash.
wincrypt.h defines only on flag under the section for CryptDeriveKey (KEY_LENGTH_MASK 0xFFFF0000).
I am new to the CryptoAPI and cant see what I am doing wrong.
Martin?? Anyone??
|
|
|
|
|
I changed KEYLENGTH to NULL. This fixed the problem, but I dont know why, or if this is the best way.
|
|
|
|
|
There were several versions of CSPs published by Microsoft. Check documentation for CryptDeriveKey() and assure that you are requesting key length supported by CSP or you are using right CSP. I think, if you will ask for a longer key than maximum length, it will refuse it with invalid flag error.
Martin
--------------------------------------------
C'mon we all know computers are experimental devices and should only be used for playing games.
Using them for alternative stuff like business, is clearly not using them for what they are intended.
Colin Davies
|
|
|
|
|
I need to swap the bytes in a struct because of little/big endian problems. Can I use swab on a struct? Is there another function or macro I can use to get around this problem?
Thanks,
Bryan
|
|
|
|
|
void SwabShort(void* wp)
{
BYTE* cp = (BYTE*) wp;
int t;
t = cp[1]; cp[1] = cp[0]; cp[0] = t;
}
void SwabLong(void* lp)
{
BYTE* cp = (BYTE*) lp;
int t;
t = cp[3]; cp[3] = cp[0]; cp[0] = t;
t = cp[2]; cp[2] = cp[1]; cp[1] = t;
}
SwabShort(&myShort);
SwabLong(&myLong);
-c
Though the cough, hough and hiccough so unsought would plough me through,
enough that I o'er life's dark lough my thorough course pursue.
--Stuart Kidd
|
|
|
|
|
thanks... works like a charm
|
|
|
|
|
I have multiple CFormView windows in a MFC Doc/View application that uses a Multiple View CSplitterWnd based class to switch out views in two of the panes. To control the app, I need to pass messages between views. I have a central control class embedded in the app's CDocument derived class that controls all the views (and maintains access to pointers to the CFormView window object via the Splitter based class).
Anyway, to the question - Should I:
1) Pass messages to the CFormView class DIRECTLY via a "virtual int SendViewMessage(...)" method since I have direct access to the CFormView based Objects;
or 2) Should I post the messages via normal Windows Message (RegisterWindowMessage) to the CFormView and let the CFormView derived classes hanlde via Message Map.
I'm not sure of the consequences of the DIRECT approach as far as the MFC Doc/View framework is concerned. I see CDocument and CView calling methods directly in MFC rather than passing messages. Is there a rule on this somewhere ???? Or, since all Doc/View framework in the same thread, does this matter at all ????
Any info would be appreciated !!!!!!
Thanks,
John
|
|
|
|
|
John Gilbert wrote:
I'm not sure of the consequences of the DIRECT approach as far as the MFC Doc/View framework is concerned. I see CDocument and CView calling methods directly in MFC rather than passing messages
There are none. You're free to invent any mechanism of data exchange between views. Or - you can use existing one - the CDocument::UpdateAllViews which gives you enough flexibility.
I'd go for UpdateAllViews first, then for custom virtual function and if this doesn't fit your model, for Windows messages.
Tomasz Sowinski -- http://www.shooltz.com
"Yields falsehood when preceded by its quotation" yields falsehood when preceded by its quotation.
|
|
|
|
|
Thanks, UpdateAllViews() will probably do the job. I did not realize that UpdateAllViews() has two user type parameters that I can use to pass my control data.
Also, someone reminded me that the CFormView Object and the actual Window are two different things. So a "Direct" call (as I was calling it) goes to the object which will eventually pass messages to the attached window anyway. I knew that , but was getting lost in the Doc/View world .
Thanks for your time to respond !!!!!
John
|
|
|
|