|
i have tried
Cdialog *d = new Cdialog(this);
d->Create(Cdialog::IDD, this);
d->ShowWindow(SW_SHOWNOACTIVATE);
and it stills do the same, it stills lose focus.
what i have notice is that using disable property of the dialog does not lose focus in the parent window but it of course disable the child window
|
|
|
|
|
I need to write an application that doesnt allow some specific websites to be opened. I think the solution is socket programming on the port 8080 but not sure about the details.
Am I wrong about the solution?
What is the solution for this?
Thanks a lot.
Mike
|
|
|
|
|
ArashFar wrote: What is the solution for this?
I don't know, but a search such as this might give you some ideas.
"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
|
|
|
|
|
Thanks but as you see the results are just bunch of companies with a proxy application to sell
Arash
|
|
|
|
|
I realize that, but sometimes even looking from the outside-in, you can glean helpful hints as to how an application works.
"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
|
|
|
|
|
DavidCrow wrote: sometimes even looking from the outside-in, you can glean helpful hints as to how an application works.
Or you could just go read something like this[^]
|
|
|
|
|
Thanks!
That is a great site
Arash
|
|
|
|
|
How can I tell if the registry key doesn't exit?
GetProfileInt(strSection, "Variable",0);
Well, this will return 0 if Variable doesn't exist by default. How can I know if "Variable" doesn't even exist, becasue I would like to do something else based on that.
Thanks
sft
|
|
|
|
|
Software2007 wrote: How can I tell if the registry key doesn't exit?
By calling RegQueryValueEx() .
Software2007 wrote: GetProfileInt(strSection, "Variable",0);
This function is intended for .ini files.
"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
|
|
|
|
|
Thanks. Am I understanding this correctly?
RegQueryValueEx():Retrieves the type and data for the specified value name associated with an open registry key.
This seems to retrieve the type of "Variable" in my example, I would like to know if "Variable" exists in the registry before I do anything to it.
Thanks
sft
|
|
|
|
|
Software2007 wrote: Am I understanding this correctly?
Software2007 wrote: This seems to retrieve the type of "Variable" in my example, I would like to know if "Variable" exists in the registry before I do anything to it.
I believe your capacity to understand is like quadrupled if you actually read the documentation
If the lpValueName registry value does not exist, the function returns ERROR_FILE_NOT_FOUND.
|
|
|
|
|
Thanks. I feel smarter already.
sft
|
|
|
|
|
The above wouldn't work for what I need. RegOpenKeyEx did.
sft
|
|
|
|
|
Hi all,
I've got a small problem with derived classes and a wrapper class. To show you what my problem is, I write down some code. Here's what I do now:
class Base
{
doFunc1();
virtual doFunc2();
}
class Der1 : public Base
{
doFunc2();
}
class Der2 : public Base
{
doFunc2();
}
class Wrap
{
Der1 *d1;
Der2 *d2;
doFunc1();
doFunc2();
}
Wrap::doFunc1()
{
if(somecondition)
d1->doFunc1();
else
d2->doFunc1();
}
Wrap::doFunc2()
{
if(somecondition)
d1->doFunc2();
else
d2->doFunc2();
}
From my program I can call:
Wrap::doFunc1();
Now I want to remove the Wrapper calls and replace them with function pointers like this:
class Wrap
{
Der1 *d1;
Der2 *d2;
(*doFunc1)();
(*doFunc2)();
}
Wrap::Wrap
{
if(somecondition)
this->doFunc1 = &Der1::doFunc1;// causes C2440
this->doFunc2 = &Der1::doFunc2;// causes C2440
else
this->doFunc1 = &Der1::doFunc1;// causes C2440
this->doFunc2 = &Der1::doFunc2;// causes C2440
}
From my program I would like to call:
Wrap::doFunc1();
The line this->doFunc1 = ... causes C2440: type cast: cannot convert from (__thiscall Der1::*)() to (__cdecl*)().
I know that class members are not the same as normal c-functions, this causes the __thiscall to __cdecl error, but I thought that there is some trick to get it to work.
Any ideas?
jung-kreidler
|
|
|
|
|
Look at the pointer-to-member operators .* and ->*
«_Superman_»
|
|
|
|
|
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
|
|
|
|