|
Does not help, since my Wrapper is a different class. Pointer-to-member works only inside a class, e.g. Testpm: void (Testpm::*pmfn)() = &Testpm::m_func1;. I need e.g. void (Wrap::*doFunc1)() = &Der1::doFunc1. Using it on different classes causes C2440
Thanks for the answer.
|
|
|
|
|
I have a dialog that is a keypad. It is called from a Login dialog. The problem is that if a mouse button is clicked outside the keypad dialog, the keypad becomes unusable. I'm thinking that this dialog should be modal. How to accomplish setting the keypad dialog as modal in the following code snippet
void CLogin::OnBnEnterId()
{
// TODO: Add your control notification handler code here
// have to place coords here, since initialization takes place later
winInfo.popup_X = 395;
winInfo.popup_Y = 50;
CKeypad kp(mainFramePtr->wndPtr, winInfo);
int intValue = 0;
if (kp.Get_Integer("Enter ID Number", 0, 99999, &intValue))
{
char temp[6];
char temp1[6];
.
.
.
.
The keypad closes on button that returns IDOK.
Thanks for your help.
AF Pilot
|
|
|
|
|
See here.
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
|
|
|
|
|
Hi All,
I want to change the width of dialog box as per the length of static text control on it,
I tried like this,
CRect rect;
GetWindowRect(rect);
CDC* pDC= GetDC();
CSize size = pDC->GetTextExtent(m_strTitle); // m_strTitle static text value variable
MoveWindow(rect.left,rect.top,size.cx,25);
but problem is that it is missing some characters from end,
about one char per 10 chars,
so for one whole big line almost 10-15 chars are missing.
what could be the posible reasons?
Thanx in advance.
|
|
|
|
|
Are you sure that DC has the same font selected into it as the static text control?
Also, you're not taking the window frame into account (you need to send WM_NCCALCSIZE[^] to the window to get the non-client size from the client size).
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
Urgent?
You, Sam, are crazy!
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
Actully problem with a font of static text control, n problem is solved as per suggesion given by Stuart Dootson that time itself,n it was urgent....I was too busy so I could not reply .
|
|
|
|
|
You should consider changing your name to too_busy_sam
«_Superman_»
|
|
|
|
|
Hey this is my short code for a basic socket setup for communicating witha client. But i seem to be getting a lot errors from the header files themselves for ex i get an error from byteorder.h where long long is used but it says undefined type. please let me know if my code is fine and what i can do regarding the errors from the header files
here is the code:
void error(char *msg)
{
perror(msg);
exit(1);
}
int main(int argc, char *argv[])
{
int sockfd, newsockfd, portno, clilen;
char buffer[256];
struct sockaddr_in serv_addr, cli_addr;
int n;
if (argc < 2) {
fprintf(stderr,"ERROR, no port provided\n");
exit(1);
}
sockfd = socket(AF_INET, SOCK_STREAM, 0);
if (sockfd < 0)
error("ERROR opening socket");
bzero((char *) &serv_addr, sizeof(serv_addr));
portno = atoi(argv[1]);
serv_addr.sin_family = AF_INET;
serv_addr.sin_addr.s_addr = INADDR_ANY;
serv_addr.sin_port = htons(portno);
if (bind(sockfd, (struct sockaddr *) &serv_addr,
sizeof(serv_addr)) < 0)
error("ERROR on binding");
listen(sockfd,5);
clilen = sizeof(cli_addr);
newsockfd = accept(sockfd, (struct sockaddr *) &cli_addr,
&clilen);
if (newsockfd < 0)
error("ERROR on accept");
bzero(buffer,256);
n = read(newsockfd,buffer,255);
if (n < 0)
error("ERROR reading from socket");
printf("Here is the message: %s\n",buffer);
n = write(newsockfd,"I got your message",18);
if (n < 0)
error("ERROR writing to socket");
return 0;
}
|
|
|
|
|
raghu valluri wrote: for ex i get an error from byteorder.h
And yet you don't show us what #include s you have in your code - your issue is likely a missing include or abad ordering of include files, so that would help.
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
Hi friends,
I would like to check whether my Active-X is registered or not.
If it isn't registered, so I'll register it; else I play my flash file.
But once I personally unregister the Active-X through "regsvr32 /u ....", CoCreateInstance function returns "S_OK" and it means it has registered successfully.
I would like to know is my way to recognize Active-X registration is correct or not and why it never
returns false when it hasn't registered before?
This is my code:
CLSID clsid;
LPUNKNOWN pUnkCtrl;
HRESULT hr = CLSIDFromString(OLESTR("{D27CDB6E-AE6D-11cf-96B8-444553540000}"), &clsid);
hr = CoCreateInstance(clsid, NULL, CLSCTX_ALL, IID_IUnknown, (void**)&pUnkCtrl);
if (SUCCEEDED(hr))
{
// The Active-X has been registered already.
AfxMessageBox("The Active-X has been registered already!");
// Play the Flash-File
}
// The Active-X does not register yet. It must be registered first.
else
{
//AfxMessageBox("The Active-X hasn't been registered yet!");
}
|
|
|
|
|
Mohammad Khodaea wrote: if (SUCCEEDED(hr))
Means:
S_OK - An instance of the specified object class was successfully created.
REGDB_E_CLASSNOTREG - A specified class is not registered in the registration database. Also can indicate that the type of server you requested in the CLSCTX enumeration is not registered or the values for the server types in the registry are corrupt.
You need to google first, if you have "It's urgent please" mentioned in your question.
_AnShUmAn_
|
|
|
|
|
Mohammad Khodaea wrote: CLSCTX_ALL
Is that *really* what you want in the CoCreateInstance call? If your ActiveX thing is an in-proc server, use CLSCTX_INPROC_SERVER , otherwise you can get some screwy resuylts - I know, I've seen them.
Mohammad Khodaea wrote: But once I personally unregister the Active-X through "regsvr32 /u ....", CoCreateInstance function returns "S_OK" and it means it has registered successfully
Is it possible that there was more than one registration for your ActiveX thing (which is possible, I believe, with Vista and XP). One of them got unregistered, you still have a registration in the registry.
Try using RegMon[^] and FileMon[^] to see what files and bits of the registry your process is touching during the CoCreateInstance call - that could point out what's not behaving according to your expectations.
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
Hello all,
In my project I am creating a SDI application without Document/View architecture in MFC(Visaul C++ 2008).
Now in it, I am creating a child window using "Create()" method with window style "WS_CHILD" and i am calling this "Create()" method from "OnCreate()" of CMainFrame class.For this newly created child window I have created a new class.Now on this new child window I have added some controls like edit boxes, buttons and these controls are also created by "Create()" method and with "WS_CHILD" style.
Now my actual problem is that when I run the application, child window gets created and I can see the controls added on the child window also but I can not access these controls means these controls are disabled. Can anyone tell how to enable these controls on child window.Please help me out.
Thanks and Regards,
Abhijit
|
|
|
|
|
Hi ,
I have created an allication, i am to build the application in Debug Mode but it am not possible to build in release mode.
I have tried in building in release mode , but am getting error as "unexpected end of file while looking for precompiled header directive".
Need Help
Thanks,
Balaji S
|
|
|
|
|
You need to set the same project properties in the release than the ones you used for debug mode (in that specific case, you have to disable precompiled headers. The different modes have their own set of properties, so each time you change something in the properties for debug mode, you have to change it for the release mode also (if this is needed, sometimes you want to have different settings).
|
|
|
|
|
Hi all
Our application has to kill OUTLOOK.exe if it runs only in background . Assuming we already have process id and handle to kill it with TerminateProcess , how to find if this outlook.exe has UI active or not ?? Any APIs please ...
redindian
|
|
|
|
|
Use EnumWindows to enumerate all open windows.
Use GetWindowThreadProcessID on the window handle to get the process Id of the window.
Compare with the process Id you already have.
Now you can use TerminateProcess (or a better way) to kill outlook.
«_Superman_»
|
|
|
|
|
I am already aware of how to enumerate the processes and kill it . What I want to know is : To find if a process is running in background or running with UI ....
redindian
|
|
|
|
|
|
dharani wrote: What I want to know is : To find if a process is running in background or running with UI ....
You may want to check out functions like IsWindowVisible() , IsWindowIconic() , SendMessageTimeout(hWnd, WM_NULL, ...) , and GetForegroundWindow() .
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
|
|
|
|
|
dharani wrote: runs only in background
Define what you mean by that.
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
My need is application will be removed after their work completed.how i do that
|
|
|
|
|
Create a batch file from within the EXE.
Run the batch file and exit the EXE.
In the batch file create a loop and try to delete the EXE.
Check ERRORLEVEL to confirm the deletion.
Delete the batch file itself.
«_Superman_»
|
|
|
|
|
Yes i need to delete the exe file itself after completion.how to create batch file.Can you please explain in brief
|
|
|
|