|
pantao551 wrote:
item which has the keyboard focus.
Use GetFocus() to find the Ctrl which currently under the Keyboard Focus.
pantao551 wrote:
how to get the ID number
Pass the HWND or CWnd return from call of GetFocus to GetDlgCtrlID which will return the Numeric ID of Control!
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
|
|
|
|
|
What Alok said, with the addition that you can use int id = ::GetWindowLong(::GetFocus(), GWL_ID); if you'd like to stay win32.
--
Schni Schna Schnappi! Schnappi Schnappi Schnapp!
|
|
|
|
|
Hi, is it any way I can send a packet using an specific port?, for example, what would I have to do if I want to send a packet using the source port xxxx?
Thx in advance
Vertigo
Real Programmer isn't who just knows how to use a programming tool, Real Programmer is who knows how to write cool stuff in any language, 'cuz he/she/(it!!?) thinks like a machine .
|
|
|
|
|
IS it possible to take a txt file as an input from a user. The txt file contains some C++ code. The code in the file is executed and the result is returned to the calliong program.
|
|
|
|
|
A crude way would be to ShellExecute the compiler (cl.exe), wait till it completes and read and return the generated binaries to the caller.
Regards
Senthil
_____________________________
My Blog | My Articles | WinMacro
|
|
|
|
|
i cannot differentiate between Cluster computing, Grid Computing, Parallel Processing! Can anyone tell me where i can see an example of the program being run on multiple clients and the result being returned to the server, something like have Cluster computing i guess?
|
|
|
|
|
How do i open an HTML Help file in a Procedure in Visual C++ 6 i want to be able to click help on the toolbar and for the help to open
I will need detailed help
Thanks
|
|
|
|
|
In the handler for your help button handler:
char* path = "c:\\help.html";
ShellExecute(NULL,"open",path,NULL,NULL,SW_SHOWNORMAL);
And there are no "Procedures" in C.
this is this.
|
|
|
|
|
|
Try here[^].
Software Zen: delete this;
|
|
|
|
|
Meaning to bascially substitue the older WinHelp function calls with appropriate parameters to the HtmlHelp function call. So read the MSDN about how to call HtmlHelp .
|
|
|
|
|
Can anyone tell me the best resources for Visual C++. I have worked on C/C++ but i've never had any experience with Visual C++. I need a few tutorials and some reallllly basic ones. Where can i get some? Tutorials that tell you how to create a form use the Microsoft IDE, etc.
|
|
|
|
|
|
hey. could anyone tell me how to send broadcast packets in C. For those of you who dont know what a broadcast packet is:
"If you send a packet to 255.255.255.0 it goes to all the computers on the network"
How can i also listen for broadcast packets. Basically, my requirement is that i have many computers on a LAN (roughtly around 30 - 50), the IP address of which are unknown. So i would like to find oit all the computes that are present on my network. I thinks this is a practical use for sending a broadcast packet.
|
|
|
|
|
to listen for a udp broadcast packet, just create a udp socket on the client machine, binding it to a certain port. eg: 22222. Then broadcasting socket should broadcast on that port.
|
|
|
|
|
okay. How can i create a UDP socket? ...and how can i send the UDP packet. Have you got any code to accomplish this?
|
|
|
|
|
how do i take 2 CStrings and join them to be 1?
im a noobie so i have no clue and cant find anything to read about it
|
|
|
|
|
Example
The following example demonstrates the use of CString::operator +.
// example for CString::operator +
CString s1( "abc" );
CString s2( "def" );
ASSERT( (s1 + s2 ) == "abcdef" );
CString s3;
s3 = CString( "abc" ) + "def" ; // Correct
s3 = "abc" + "def";
// Wrong! The first argument must be a CString.
|
|
|
|
|
|
Any idea how to embed an exectuable inside another executable, and then from with in your program, call the embeded exectuable with out creating another process or wrting the embed exectuable to disk?
I have a C++ program (straight C++, not managed). It has some logic and then depending on a number of conditions, ShellExecute()s another exectble file (client.exe), which happens to be a .net file. Is there anyway that I can add this client.exe file as a resource of my C++ program, and then call the beginning of the code from within the C++ program, so I wouldn't have to extract the resource or create a new process
Please help
Thanks,
Jason A. Donenfeld
PS: This is what I have now:
<br />
#define WIN32_LEAN_AND_MEAN<br />
#include<br />
#include<br />
#include<br />
<br />
#define INSTANCEMESSAGE "ShowZIM"<br />
#define WINDOW_TITLE "ZX2C4InstantMessenger"<br />
#define MUTEX_STRING "Local\\ZX2C4IM"<br />
#define FILE "client.exe"<br />
<br />
int APIENTRY _tWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPTSTR lpCmdLine, int nCmdShow)<br />
{<br />
if(_tcscmp(lpCmdLine,"clone"))<br />
{<br />
CreateMutex(NULL,TRUE,MUTEX_STRING);<br />
if(GetLastError()==ERROR_ALREADY_EXISTS)<br />
{<br />
SendMessage(FindWindow(NULL, WINDOW_TITLE), RegisterWindowMessage(INSTANCEMESSAGE), NULL, NULL);<br />
return 0;<br />
}<br />
}<br />
ShellExecute(NULL,NULL,FILE,lpCmdLine,NULL,SW_SHOW);<br />
return 0;<br />
}<br />
|
|
|
|
|
The following is a general purpose method for retrieving any binary data from your program's resources:
HRSRC resource_handle = ::FindResource(AfxGetResourceHandle(),
MAKEINTRESOURCE(IDR_PROGRAM),
"PROGRAM");
if (resource_handle != NULL) {
HGLOBAL resource_memory = ::LoadResource(AfxGetResourceHandle(),
resource_handle);
if (resource_memory != NULL) {
LPVOID resource_data = ::LockResource(resource_memory);
DWORD resource_size = ::SizeofResource(AfxGetResourceHandle(),
resource_handle);
if ((resource_data != NULL) && (resource_size > 0)) {
}
}
} The corresponding resource.h and .RC look like this:
#define IDR_PROGRAM 1234
IDR_PROGRAM PROGRAM "Program.exe" I've used this method a number of times. It's handy for simple programs. For example, I've got a tool application that consists of a single .EXE and a help file. Rather than make an install, I include the help file in the .EXE as a resource, and extract it as necessary.
Software Zen: delete this;
|
|
|
|
|
Oops . I didn't see your qualification about not extracting the executable. Sorry.
I don't think what you're asking is possible under Windows. An executable is actually a set of data structures, along with the compiled code. The loader is responsible for reading those data structures and the code, placing that in memory and then running it. You would have to somehow emulate the loader process, or invoke it yourself. I don't know of a public API that lets you do that.
Software Zen: delete this;
|
|
|
|
|
Hi there...
i am using CFileDialog to save and move files...
but i need to add an edit box in that dialog so users
can add comments...
can i overwrite/edit sumthing in CFileDialog class to add
new controls?
tnx 4 d help
|
|
|
|
|
|
I am updating a Visual C++ program's GUI, and I am getting some parsing errors from by the Visual C++ class wizard for one of the classes.
One of the parsing errors has the following form:
In file WizardDlg.h, I have
// Dialog Data
//{{AFX_DATA(CWizardDlg)
enum { IDD = IDD_WIZARD_DIALOG };
CButton m_button[3];
//}}AFX_DATA
In file WizardDlg.cpp, I have:
void CWizardDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CWizardDlg)
DDX_Control(pDX, IDC_BUTTON3, m_button[0]);
DDX_Control(pDX, IDC_BUTTON2, m_button[1]);
DDX_Control(pDX, IDC_BUTTON1, m_button[2]);
//}}AFX_DATA_MAP
}
The code compiles, but I get the class wizard parsing error
Parsing error: Expected ";".
Input Line: "CButton m_button[3];"
I know one way to fix this error: replace the array with three separate CButton m_button instances, i.e.
CButton m_button1;
CButton m_button2;
CButton m_button3;
DDX_Control(pDX, IDC_BUTTON1, m_button1);
DDX_Control(pDX, IDC_BUTTON2, m_button2);
DDX_Control(pDX, IDC_BUTTON3, m_button3);
However, I may not be able to use this approach without changing a lot of code. Is there a way to make the parser accept the CButton m_button[3] array, or something like it?
This is an important project for work, so any advice would be greatly appreciated.
|
|
|
|