|
|
I am looking for a control that I use to build a view of an indented Bill Of Material where the folder represents an assembly and items are under the folders. Can be nested as many levels as necessary. It would be nice to be able to search the control for the existence of any part number or description. Any suggestions?
|
|
|
|
|
Dear all,
I have a quarrel with my friend as bellow:
In object oriented programming we declare a class:
class CAA
{
public:
CAA();
void DelMyself()
{
delete this;
}
private:
virtual ~CAA();
}
I said that no body do at that. But he said it is used a lot of in MFC.
in this situation you only declared pointer of class CAA not declare a object.
Please give some comemnt.
Thanks a lot,
|
|
|
|
|
Chau Ngoc Vo wrote:
about C++
Um... a question about C++ in the C++ forum, who would have thought ? You'll get more readers if you actually say something in your headers.
Chau Ngoc Vo wrote:
I said that no body do at that. But he said it is used a lot of in MFC.
Did either of you think to actually type this into a compiler and see what it spits back ?
Your friend is right. If it's used in MFC or not, I don't know.
Christian
I have drunk the cool-aid and found it wan and bitter. - Chris Maunder
|
|
|
|
|
It's often used in MFC and ATL where instances are stored in a OS objects that have no knowledge of C++.
Anyone who thinks he has a better idea of what's good for people than people do is a swine.
- P.J. O'Rourke
|
|
|
|
|
It's used in CFrameWnd in PostNcDestroy. CFrameWnds should always be created with new, so it can call "delete this" as the last thing it does before the window is gone.
|
|
|
|
|
Another example of delete self is in modeless dialog box.
modeless dialog boxes delete themself
The World is getting smaller and so are the people.
|
|
|
|
|
dwLength = sizeof(TCHAR)*_tcslen(m_tContents);
BYTE *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 %d %d ", m_strResultingText, dwLength, m_strResultingText.GetLength());
MessageBox(strShow);
}
why does this show:
After: encrypted-text 2359 225
Its been really buging me (no pun intended)
-Steven Hicks
CPACodeProjectAddict
|
|
|
|
|
There's probably a zero byte at position 225 in the encrypted data. Once encrypted, you should treat the encrypted data as just any other array of bytes, not as a C-style string.
If you need to pass the data through some channel that isn't fully 8-bit clean, you should encode it, perhaps using hex, Base64, UUEncode, ...
|
|
|
|
|
Hi,
I have two LPCWSTR and I want to compare them to find if they are same string. How do I use trim() function on LPCWSTR so that I can trim them before comparing?
|
|
|
|
|
// This program is a test to verify whether or not the theory illustrated
// in Digital Fundamentals pg60 of 32 bit binary number recognition, is
// applicable with regards to an AMD 1.4 Ghz processor.
#include<iostream>
#include<climits>
#include<cmath>
using namespace std;
int mantissa;
int max_integer=0;
int temp=0;
int main()
{
mantissa = 30;
while(mantissa!= -1)
{
temp = pow(2,mantissa);
max_integer = max_integer + temp;
--mantissa;
}
cout<
|
|
|
|
|
// So if the maximum integer possible on this machine uses 31 bits, and this is a 32 bit
// processor, what is the other bit used for?
For the sign. Compare this with unsigned int s, which, as they do not store any sign, can be twice as large (plus one) as the maximum int .
PS: I don't really understand the code, though, looks interesting, will have a look at it.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
Hi
I have a program that needs to open a file.
the name of the file will be typed in a textBox in the form.
my question is how can i open this file?
working with console application. I usually asked the user to input a char array. and then
char file[20];
cin>>file;
infile.open(file, ios::binary | ios::in);
but now what I get from a text box is :
String *s=textBox->Text;
and I dont know how to convert this CAPITAL Strint to a normal char array?
by the way does any one have a folder browsing code with c++?
thanks;)
maryam
|
|
|
|
|
1. when i SetFont() for a CEdit, it'll show only fonts larger than the 8pt (i specifically use "MS Sans Serif"). how can i cure this?
2nd issue is how to shrink the "selected" CEdit rectangle (single line), it seems it has nothing to do with actual CEdit window size?
Much obliged.
-~-~-~-~-~-~-~-~-~-~-~-~-~-~-
Email: y_becker@netvision.net.il
|
|
|
|
|
I want to prevent the rebar from dropping onto the next line when my main window is resized.
I tried handling CMainFrame::OnChildNotify() and returning FALSE for RBN_AUTOSIZE...i've specified RBS_AUTOSIZE when creating a Rebar, what am I doing wrong...?
Anyone have any idea what I"m doing wrong...?
Thanks
The word of the day is legs, let's go back to my house and spread the word
|
|
|
|
|
Does anyone know the right way to get the ASCII code to a character. Because i made a program that reads in a string of text and then uses keybd_event() to output all the characters again, but it gets all messed up when i just use the integer value of the characters in my program...
Kuniva
--------------------------------------------
|
|
|
|
|
Can you post the section of code?
|
|
|
|
|
char message[1024];
cout << "Message: ";
cin >> message;
for(int t=0;t<(strlen(message));t++)
{
keybd_event(message[t]-32,0,0,0);
keybd_event(message[t]-32,0,KEYEVENTF_KEYUP,0);
}
The -32 is to make lowercase letters work, but thats it.
Kuniva
--------------------------------------------
|
|
|
|
|
I want to do add a "working" animated bitmap or avi that plays in the top right of my application when it's working.
This would be the same functionality that Internet Explorer has at the top right of it's application.
Looking at IE, the animation is actually at the far right of the main menu bar.
I sort of remember that in old versions of windows, you could position a help menu at the far right. Presumably this technique might be combined with adding a new control, but I've not figured out how to do this.
I've done some searching on various sites, and found nothing. I thought that was surprising, since most applications want to emulated IE.
Can anyone point me to a technique that might bear fruit?
Thanks!
Gene
|
|
|
|
|
IE uses toolbars for everything - its frame window doesn't have an actual menu. That little logo is actually a nonresizable band in the rebar.
If your app has an actual menu, you can set the "Help" style on the rightmost item in the main menu, and owner-draw it.
--Mike--
Ericahist | CP SearchBar v2.0.2 | Homepage | RightClick-Encrypt | 1ClickPicGrabber
Four fonts walk into a bar. The bartender says "Hey - get out! We don't want your type in here."
|
|
|
|
|
Funny, because I've just done that
Great minds think alike
Cheers
The word of the day is legs, let's go back to my house and spread the word
|
|
|
|
|
You mean that every one who does owner drawn menus are great?????
Destroy the constitution coz they make the politicians.
|
|
|
|
|
I have a 16-bit application to which I've manually added some new controls to a form in the .rc file. I've also updated the resource.h file and the relevant implementation files. The project builds but with the result that the form no longer displays itself when invoked. I've managed to establish that OnInitialUpdate does not get called. However, when the form is opened in the resource editor (I'm using VC++ 1.51) the added controls are visible.
Does anyone know of any issues to be aware of when performing manual edits to a .rc file?
If I remove the entries from the .rc file and comment out the referneces in the .cpp file, the form shows itself as usual.
My additions to the .rc file look like this:
LTEXT "Term",IDC_STATIC,145,22,18,8
CONTROL "%nW###",IDC_EDIT_TERM,"HEdit",WS_BORDER | WS_TABSTOP |
0x200,168,22,19,12
CONTROL "",IDC_SCROLL_TERM,"MicroScroll",0x1,188,22,11,12
Kevin
|
|
|
|
|
Did you remember to register the HEdit and MicroScroll window classes? From my dim recollection of Win16 (and I have to ask - why the heck are you extending a Win16 application??) you only have to register a window class once, when the first instance of your application starts up.
Otherwise, no suggestions, sorry.
|
|
|
|
|
What do you mean by register? Do you mean stuff like this?
#include "spin.h"
IMPLEMENT_DYNAMIC(CSpinControl, CWnd)<br />
<br />
BOOL CSpinControl::Create(DWORD dwStyle, const RECT& rect,<br />
CWnd* pParentWnd, UINT nID)<br />
{<br />
return CWnd::Create("MicroScroll", NULL, dwStyle, rect, pParentWnd, nID);<br />
}<br />
<br />
WNDPROC* CSpinControl::GetSuperWndProcAddr()<br />
{<br />
static WNDPROC pfnSuper;<br />
return &pfnSuper;<br />
}
The reason I'm extending a Win16 application is because that's what the client wants!
Kevin
|
|
|
|