|
I need to place a ListCtrl inside a RichEdit document (MDI). How do I do this? Also how do I setup event messages (double clicking on an item) for the control?
|
|
|
|
|
this document can help:
http://codeproject.com/listctrl/listctrldemo.asp
|
|
|
|
|
I actually need to know how to place the control in a RichEdit Document. I understand how to place it in a dialog but not inside a doc/view.
|
|
|
|
|
Hi Guys,
I would like to retrive the Unique ID of my computer in VC++ code. Can any one can help with the sample function to retrive the unique ID.
Thank You.
Regards
.
|
|
|
|
|
What Unique ID?
-- Rocky Dean Pulley
|
|
|
|
|
I assume you're talking about the SID.
Check out the NewSID program by Mark Russinovich over at SysInternals. It comes with the source code and should tell you way more than you were wanting to know.
Excerpt from the article:
A computer's SID is stored in the Registry's SECURITY hive under SECURITY\SAM\Domains\Account. This key has a value named F and a value named V. The V value is a binary value that has the computer SID embedded within it at the end of its data.
|
|
|
|
|
Does anyone know if visual c++ 6 MFC will let me insert jpg files. I have found in the properties box of a picture object Bitmap, Icon, etc. I tried importing a jpg, but did not seem to work.
Regards
Paul
|
|
|
|
|
What do you want to do with the jpg ? GDI+ will allow you to read and write JPGs, as well as draw to them/draw them to a Graphics object ( which you can build from a HDC )
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
And if you do not want to have to distribute the GDI+ library (1661 KB) you can use the IPicture interface to read and display jpgs. Although I do not think IPicture can be used to save jpgs.
"You're obviously a superstar." - Christian Graus about me - 12 Feb '03
"Obviously ??? You're definitely a superstar!!!" mYkel - 21 Jun '04
Within you lies the power for good - Use it! Honoured as one of The Most Helpful Members of 2004
|
|
|
|
|
|
|
Hi,
I'm developing a toolbar for the taskbar and it works fine in windows Xp. Now I have to make it work in Win98. I added the unicode layer for win98 and tested it... But I just crashed... I discover that the crashed are in API calls like CreateWindow and MoveWindow... (Those calls works well in WinXP, all the parameters seems to be ok, etc).
Other interesting thing is that not all calls crashes. Some does, but some does not. But it's not random.
For example the MoveWindow call just crash with something like:
Run-Time Check Failure #0 - The value of ESP was not properly saved across a function call. This is usually a result of calling a function declared with one calling convention with a function pointer declared with a different calling convention.
And the CreateWindow crash with (Sorry, I have the message in spanish, but its a stack error at module ...):
REGSVR32 provocó un error de pila en el módulo KERNEL32.DLL de 0167:bff724c1.
Please, if any one has a hint, I'm really stuck with this.
|
|
|
|
|
Hello,
I want to get direct3d to draw on my desktop background behind my icons, etc. Any idea of how I could go about this. I know how to do it with directdraw but apparently it is not being updated anymore so I want to do it with direct 3d. Thanks.
|
|
|
|
|
AFAIK, DirectDraw just got assimilated into D3D.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
I add a CListCtrl control to my dialog app. I want to edit its sub item, so I add handler for LVN_BEGINLABELEDIT. In the function, I have the following:
.....
CEdit *pEdit = my_listCtrl.GetEditControl();
if ( pEdit )
{
pEdit->SetWindowPos(&wndTop, subRect.left, subRect.top, subRect.Width(), subRect.Height(),
SWP_NOZORDER | SWP_NOSENDCHANGING);
}
....
but although I specified SWP_NOSENDCHANGING, windows still put the edit control over the LABEL area of the list control.
How can I position the edit control at the position specified?
Thank you for any help!
|
|
|
|
|
Hey all, I was wondering how I might go about mixing a C++ dll with C# windows form.
I am currently creating a C++ dll to use within another application that allows scripts to call into dlls, for a fun/learning project. Though I have been able to figure out how to perform simple function calls, I am a bit clueless as to how I might go adding GUI components into the mix. In the end I would like to able to add a toolbar to the outside application. Ideally, because it is so simple to create windows forms in C#, I would like to be able to create the toolbar in C# and have it call my dll functions. Though I have done some searching, I am a bit lost on where to even begin.
As a first step, I would like to write a simple function in my C++ dll that creates a simple HelloWorld windows form (script calls dll's helloWorld -> dll creates C# form). Though I can do either by itself, I am not sure how to call the form from within the dll, as well as how to go about having C# and C++ in the same visual studio project. If anyone could point me in the right direction, I would be very thankful.
|
|
|
|
|
I'm trying to write an application that, upon startup or resizing, will resize one other, or several other windows (So that my application shares the screen on the right.) I also need to resize the displayed programs when I close or minimize my application. For that matter, where do I specify where my window is placed on startup?
|
|
|
|
|
Basically the process involves two steps.... 1. getting a handle to the window you want to resize 2. resizing it
I think your best way is to go
HWND wnd = FindWindow(strWindowClassName, strWindowName);
if(wnd != NULL)
{
MoveWindow(wnd, X, Y, width, height, TRUE);
}
else TRACE0("Window Not Found!"); Try that. You will need your window's name - that's what you see on the title bar, and you'll need it's class name - you can get that with Microsoft Spy++ which comes with Visual Studio. If you really can't get the class name then use NULL.
Joel Holdsworth
Wanna give me a job this summer?
Check out my online CV and project history[^] - now available in MSWord format![^]
|
|
|
|
|
I tried this suggestion and found two errors:
error C2440: 'initializing' : cannot convert from 'class CWnd *' to 'struct HWND__ *'
error C2661: 'MoveWindow' : no overloaded function takes 6 parameters
How should I resolve these?
(I put it in PreCreate Window, to start)
Also, you said that the window's name is what you see on the title bar. What about for programs like internet explorer, where what you see on the title bar changes depending on what page you are on, or where in the program you are?
|
|
|
|
|
Ok... you're using MFC. I think if you put <ocde>:: in front of both function calls, that should sort you out!
HWND wnd = ::FindWindow(strWindowClassName, strWindowName);
if(wnd != NULL)
{
::MoveWindow(wnd, X, Y, width, height, TRUE);
}
else TRACE0("Window Not Found!");
Joel Holdsworth
Wanna give me a job this summer?
Check out my online CV and project history[^] - now available in MSWord format![^]
|
|
|
|
|
Can anyone explain what is happening here? I am trying to create overloaded relational operators for class member enums. VC6.0 and gcc 3.3.4 compile the code fine. VC7.0 and 7.1 complain that the overloaded operator function is ambiguous. The following code illustrates the problem:
class A
{
public:
enum level
{
none, low, medium, high
};
};
bool operator>( A::level l1, A::level l2 )
{
bool greater = false;
switch( l1 )
{
case A::low:
switch( l2 )
{
case A::none: greater = true; break;
}
break;
case A::medium:
switch( l2 )
{
case A::low:
case A::none: greater = true; break;
}
break;
case A::high:
switch( l2 )
{
case A::medium:
case A::low:
case A::none: greater = true; break;
}
break;
}
return greater;
}
int
main( int argc, char * argv[] )
{
A::level l1 = A::high;
A::level l2 = A::low;
if( l1 < l2 )
{
return 1;
}
if( l1 > l2 )
{
return -1;
}
return 0;
}
VC6.0 and gcc compile cleanly. VC7.0 and 7.1 fail with the following error:
Compiling...
enumtest.cpp
d:\misc\test.cpp(54) : error C2593: 'operator >' is ambiguous
d:\misc\test.cpp(13): could be 'bool operator >(A::level,A::level)'
or 'built-in C++ operator>(A::level, A::level)'
while trying to match the argument list '(A::level, A::level)'
What are the built-in operators mentioned? Is the compiler assuming that an enum-is-an-enum-is-an enum, and thus bypasses the strong typing? What is the correct way to write this that conforms to the standard and is portable?
Any and all insights will be welcome.
|
|
|
|
|
struct employee
{
int emp_id;
char name[20];
};
void main()
{
struct employee *A;
struct employee **B;
B = &A;
//how do i access the emp_id and name field of **B
}
how can i change the emp_id and the name field of **B? th complier allowes me to write A->name = "whatever"; but it doesnt allow me to write b->name = "whatever";.
|
|
|
|
|
try
(*B)->emp_id = 0;
C makes it easy to shoot yourself in the foot; C++ makes it harder, but when you do, it blows away your whole leg
|
|
|
|
|
Mridang Agarwal wrote:
how can i change the emp_id and the name field...
In your example, you cannot. Doing so would yield an access violation because an instance of the employee structure does not exist.
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
I have used part of this code from a tutorial I found on this website and I am now trying to adapt it into being useful for my program to use the data it recieves. I am probably doing totally the wrong thing as some of it I don't really understand yet as I am fairly new to c++. I know the data that is being recieved is "START" as it echos the data into the console so that I can see it. However when I come to the if statements it is not proccessing the data and echoing back the statements I want it to. The code is below for the part of the program which proccesses the data. I know the rest of the program works it is just using the data in the if statments. If you need any more information please just ask and I will try to provide it to you as best as I cant. Thanks in advance to anyone that helps.
UINT ClientThread(LPVOID pParam)
{
char buff[512];
CString cmd;
CString params;
int n;
BOOL auth=false;
SOCKET client=(SOCKET)pParam;
strcpy(buff,"#Server Ready.\r\n");
send(client,buff,strlen(buff),0);
while(true)
{
n=recv(client,buff,512,0);
if(n==SOCKET_ERROR )
break;
buff[n]=0;
std::cout << "Data: " << buff;
if(buff=="QUIT")
{
std::cout << "QUIT Command Recieved\r\n";
break;
}
if(buff=="START")
{
cout << "Start Command Recieved\r\n";
}
closesocket(client);
return 0;
}
}
|
|
|
|