|
|
I'm trying to save CDIalog objects in a vector, and it doesnt like the push_back since no copy constructor is available. How do I get around this?
Appreciate your help,
ns
|
|
|
|
|
save the addresses of the dialogs.
myVector.push_back(&someDialog);
Max.
|
|
|
|
|
Thats what I am going to do now. IT will be fine for my current tests, but I dont know if I'll need the actual object later. If I do I can alwyas deref this pointer right?
Appreciate your help,
ns
|
|
|
|
|
if it's in a vector you need to do something like :
CDialog* pDialog = (*it);
Max.
|
|
|
|
|
Thanks very much! It seems like it will do, except I'm troubled by a null pView pointer so I cant test things out yet ...
I have another thread about it.........
Since I was getting a null pView I resorted to externing for the moment and now I am getting a crash on the
CImageDisplay* imageDisplay =m_imageDisplayVector[0];
imageDisplay->GetWindowPlacement(&wp);
GetWindowPlacement, and thats because the pointer coming out of the vector (I only had one element in it) is null!!!!!
I'm plagued by null pointers today...
Help!
Appreciate your help,
ns
|
|
|
|
|
I want the location and size of my CDialog that was spawned by a CView. In the OnDestroy of the mainframe I will save the location,size etc. I have access to the CDIalog object I created.
SO if I do
imageDisplay.GetWindowRect(&rect);
what will come back in rect?
imageDisplay = *pdlg where pdlg was the modeless dialog pointer used in pdlg->Create()
Is this rect.top, .left etc not in terms of the coordinates of the Computer screen? MSDN says :
Copies the dimensions of the bounding rectangle of the CWnd object to the structure pointed to by lpRect. The dimensions are given in screen coordinates
Someone said to use GetWindowPlacement. Wont the GetWindowRect give me everything I need?
For GetWindowPlacement MSDN says:
rcNormalPosition<br />
<br />
Specifies the window’s coordinates when the window is in the normal (restored) position. <br />
but doesnt tell me what the coordinates origin is...
Appreciate your help,
ns
|
|
|
|
|
GetWindowRect tells the current screen coordinates.
GetWindowPlacement will tell you if the window is minimized, maximized or restored (normal) and it will tell you the coordinates of the window in restored state. These may be different from the current ones e.g. when the window is maximized.
Oliver
|
|
|
|
|
I used CryptAcquireContext with MS_ENHANCED_PROV and then created an RC4 key. I want to export this key without any encryption. I tried using PLAINTEXTBLOB on CryptExportKey. It works fine on XP, but fails on 2000 (with Enhanced Provider installed) with error NTE_BADKEY.
m_sessionkey is valid at that point. I can export it using my public key.
The line of code:
<br />
if (!CryptExportKey(m_sessionkey, 0, PLAINTEXTKEYBLOB, 0, NULL, &length))<br />
{<br />
DWORD dwErr = GetLastError();<br />
LogError(dwErr);<br />
return false;<br />
}<br />
std::vector<BYTE > keydata;<br />
keydata.resize(length);<br />
if (!CryptExportKey(m_sessionkey, 0, PLAINTEXTKEYBLOB, 0, &keydata[0], &length))<br />
{<br />
DWORD dwErr = GetLastError();<br />
LogError(dwErr);<br />
return false;<br />
}<br />
My article on a reference-counted smart pointer that supports polymorphic objects and raw pointers
modified 29-Aug-18 21:01pm.
|
|
|
|
|
not being an expert with microsoft's cryptoapi I would check if the key is generated with Exportable flag.
Might be also the Q228786 will be usefull for you. Don't have any more clue with great microsoft's CryptoAPI
|
|
|
|
|
|
I understand, but having no idea what was changed in XP crypto provider. Might be some small change, don't know. Can it be a question of service pack installed in W2K?
|
|
|
|
|
If you want the key value try this article:
http://www.codeproject.com/cpp/plaintextsessionkey.asp
Raphael Amorim Dantas Leite
VC++, VB, Java, .NET and eMbedded Programmer
|
|
|
|
|
|
I was wondering, pondering even, what would be the easiest way to check 1 character in a CString to see if it was a number?
The scenario is I have a string that could either be www.blah.com or it could be 123.123.123.132 or some other domain name or IP. I want to check whether its a domain name or IP address before I process the details, but I can't decide on the easiest way to do it.
Would a nasty if (string.GetAt(0}=='1')||(string.GetAt(0)=='2'.......
be the easiest way or is there some other technique I've not noticed?
Cheers lads & lassies
|
|
|
|
|
|
fantastic, I knew there was something I was missing but I just couldn't see it.
Thanks for the great fast help
|
|
|
|
|
|
maybe something along the line of IsNumeric(string.GetAt(0)) ? I am not sure of output of string.GetAt(0), there fore assuming that you are extracting the first character from the string.
hope this helps
|
|
|
|
|
How can I prevent my MFC SDI app from trying to load the related file type when a user opens the file type from windows explorer. I'm gettting it form the view class..How do I keep the doc class from opening it?
-Steven
By reading this message you are held fully responsible for any of the mispelln's or grammer, issues, found on, codeproject.com.
For those who were wondering, actual (Linux) Penguins were harmed in creating this message.
|
|
|
|
|
Do you still want the application to load, but not load the document? Or do you not want any associations made at all (i.e. file type wont even get a new icon)?
To answer the first is to simply ignore any command-line parameters that request a file to be opened. i.e. when you CCommandLineInfo objects m_nShellCommand member equals CCommandLineInfo::FileOpen .
As for the second, remove the following entries to your InitInstance.
EnableShellOpen();<br />
RegisterShellFileTypes(TRUE);
Also, if you've already run you application, which if my assumption is correct, you already have, you'll have to go and physically remove the associations from the registry (HKCL\.ext--where ext is the extension of the file you’re project was initially created to modify).
cheers,
-B
|
|
|
|
|
Hello,
i need to realize a dropdown-button within a toolbar by using mfc70. I added the extended style TBSTYLE_EX_DRAWDARROWS to the toolbar and also i modified the style of the corresponding button (TBSTYLE_DROPDOWN). Clicking on the arrow will call the message-handler i defined in the following way :
afx_msg void OnToolbarDropDown(NMHDR* pnmh, LRESULT* plRes);
The message-map-entry is the following :
ON_NOTIFY(TBN_DROPDOWN, AFX_IDW_TOOLBAR, OnToolbarDropDown)
In the msdn-description the NMHDR-structure is defined as
typedef struct tagNMHDR {
HWND hwndFrom;
UINT idFrom;
UINT code;
} NMHDR;
I thought that i could read the idFrom-value to determine the resource-ID of the button where the arrow was clicked. But for different dropdown-buttons the value is always the same and it matches to no button-ID available! So how can i determine the id of the corresponding dropdown-button by using the NMHDR-structure instead of the NMTOOLBAR-structure (used in vc60)?
Best regards
tabor25
|
|
|
|
|
hi all!!
I need to take a look at some good shareware / registration coding techniques /tips.
I have made an app. that im going to release as shareware, and now i just need to plug in some kind of reg. code scheme to enable the features once they enter my code or something like this.
id like pros / cons of the various standards available, and some links would be great too...
thanks for anyones help in advance...
josh
todo....
:: insert inpirational text here ::
|
|
|
|
|
Don't bother with registration and stuff like that.... if it's a good shareware, it will be cracked and hacked.
just make a "free" shareware nag-ware, with pop-up dialogs showing from time to time, remove some basic functionnalities ( like save/export ... ), limit some other functionalities ( e.g. limiting input size, limit number of files loaded in one runtime, ... )
One thing, you can do, is to have the user need to send you a valid Email to download the software, in the Email, you give a one-time only full download path; but that is extra work on the web site.
Max.
|
|
|
|
|
Hello,
You should keep it simple: it will be cracked anyway if it catches some attention! I used an encryption algorithm (Blowfish in my case): I encrypt the e-mail of the registered user using a private key and the algo. You will get an hexadecimal buffer (16 chars ranging from 0 to 255) that you can translate to something that can be typed: for instance change each character to its written hexadecimal representation on two characters: this has the disadvantage of doubling the length of your serial number but that's the way it is. You get something like B0AA7D4350A88F... and so on.
If you want to do an evaluation period for it you should refer to http://www.codeproject.com/system/cexpire01.asp[^], a good stuff available.
Regards,
mynab
|
|
|
|