|
What's the question?
For new socket programmers, usually the confusion seems to be in the fact that as far as the socket is concerned, you're passing data bytes, it doesn't care what the data is (integers, text, whatever). So you just have to load some buffers with your data and pass it on, it's up to your server/client to be able to interpret the data correctly. The interface definition (what bytes mean what) is usually referred to as an API (i.e. the rules).
|
|
|
|
|
Dear Developers,
I am trying to show/hide a explorer control via ShowWindow() function. Along with I have done disable/enable of that control. But application is getting crashed on it. I have written the code is like this.
GetDlgItem(IDC_EXPLORER_LICENSE)->ShowWindow ( SW_SHOW ); GetDlgItem(IDC_EXPLORER_LICENSE)->EnableWindow( TRUE );
One thing should be noted that I have done the same thing for some other controls( like static and picture ), but for that it's working properly.
Can any one help me out.
Thanks in Advance.
Amrit Agarawal
Software Developer
|
|
|
|
|
what does GetDlgItem(IDC_EXPLORER_LICENSE) return ?
|
|
|
|
|
According to the docs on GetDlgItem()
Quote: A pointer to the given control or child window. If no control with the integer ID given by the nID parameter exists, the value is NULL.
In your code, GetDlgItem() is in the context of a CWnd / CDialog. Are you sure the control IDC_EXPLORER_LICENSE is defined to be in that CDialog? The debugger should show you the value of "this" when you crash inside ShowWindow().
|
|
|
|
|
Is there anyone that can explain why a modeless dialog is blocking the parent window. I thought that the moduless dialog was an standalone thread that did not inhibit the parent process to execute.
What is differences between a background thread and a modeless dialog?
|
|
|
|
|
See here[^] for information on modeless dialog boxes.
A background thread operates totally independently of the main thread of your application. A modeless dialog box interacts with (and is partly controlled by) its parent window.
Unrequited desire is character building. OriginalGriff
I'm sitting here giving you a standing ovation - Len Goodman
|
|
|
|
|
The two concepts aren't really related. A "modeless dialog" is simply the behavior of a window, it doesn't imply what thread it's operating on, in another words, a modeless dialog (by default) will still be in the same thread as the parent window (although it doesn't have to be). Now a background thread, well, that implies complete processing independence from the main application.
|
|
|
|
|
I have an MDI application which is using CMFCVisualManager and showing nice themes
It also has some dialogs for example About dialog which is not using this theme. Can I apply this them on that? How?
I have VS 2008 + MFC featured pack with some service pack.
|
|
|
|
|
I am trying to be able to send socket commands from a MFC program but my parent window is blocked see the message below.
Is it possible to use fork to start another MFC program?
What is the simplest way to communicate with this programs?
I was thinking to using three files. One that indicates that that data is sent by Master program and another file that is used by Sölave that tells that it is processing data and a third file that data actually is stored in.
Is there a better way to do this I have just a few days to fix this problem on so it should be a simple solution?
|
|
|
|
|
See this message[^] below by enhzflep on the use of threads; it could well be what you are looking for.
Unrequited desire is character building. OriginalGriff
I'm sitting here giving you a standing ovation - Len Goodman
|
|
|
|
|
Are you sure that this will inhibit the parent window message queue/parent dialog from be blocket? What is the differences beteen create a modeless dialog comared with this thread?
Is there anyone that can explain why a modeless dialog is blocking the parent window. I thought that the moduless dialog was an own thread that did not inhibit the parent process to execute.
modified 19-Nov-11 5:24am.
|
|
|
|
|
Yes, the background thread will run independently of the main window thread so your message pump will continue to run. I am not sure whether a modeless dialog would be better, it all depends on what your program is trying to do.
Unrequited desire is character building. OriginalGriff
I'm sitting here giving you a standing ovation - Len Goodman
|
|
|
|
|
The only thing I do is sending out a message by using CSocket/CTimeoutSocket, but if fail to connect to the unit I try to access both the modeless dialog and the parent dialog is blocked.
Is there anyone that can explain why a modeless dialog is blocking the parent window. I thought that the moduless dialog was an standalone thread that did not inhibit the parent process to execute.
What is differences between a background thread and a modeless dialog?
|
|
|
|
|
I am trying to create a program in MFC that talkes to several wireless IP-routers on internet. Now and then will a router be disconnected, and when that happen will the parent window in my MFC program be blocked for a while, which is not acceptable.
The reason for this is that in my MFC program it should be possible for a user to send and receive commands to one of the router while the other routers is supervised (I sending a special command to these router to see if they is still up and running).
The problem is that if one of the routers is disconnected and my MFC program sends out a supervise command to this router will the main window be blocked which means that a user cannot use the parent window for 30 seconds or so.
I have tried to solve this with a worker thread but I could not invoke any CTimeoutSocket from this thread since the MFC program stopped working then.
So I tried to create a hidden modeless dialog and put all the CTimeoutSocket code in this dialog but when a socket is blocked for a while will not only the modeless dialog be blocket but also the parent window.
So have anyone any idea how I shall do to inhibit the parent window from be blocked?
modified 19-Nov-11 3:15am.
|
|
|
|
|
Use non-blocking sockets[^] (i believe the MFC version is CAsyncSocket[^], never used it though).
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> If it doesn't matter, it's antimatter.<
|
|
|
|
|
**********
*********
********
*******
******
*****
****
***
**
*
#include "stdafx.h"
#include <iostream>
using namespace std;
int _tmain(int argc, _TCHAR* argv[])
{
for (int r=1; r<10; r++)
{
for (int c=r; c>1; c--)
cout<<" ";
for (int j=r-1+1;j<=10;j++)
cout<<"*";
cout<<endl;
}
--------------------------------------
*
**
***
****
*****
******
*******
********
*********
#include "stdafx.h"
#include <iostream>
using namespace std;
int _tmain(int argc, _TCHAR* argv[])
{
for (int r=10; r>1; r--)
{
for (int c=r; c>1; c--)
cout<<" ";
for (int j=r-1+1;j<=10;j++)
cout<<"*";
cout<<endl;
}
return 0;
}
|
|
|
|
|
Read the guidelines[^] before making another post.
"Real men drive manual transmission" - Rajesh.
|
|
|
|
|
Is there a question hidden in your post?
"One man's wage rise is another man's price increase." - Harold Wilson
"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
"Show me a community that obeys the Ten Commandments and I'll show you a less crowded prison system." - Anonymous
|
|
|
|
|
Hello
I want to know how can i animate from triangle 1 to triangle 2 that we can see the movements.
i want to know how can i move characters that indicate that they moves.
tnx alot
|
|
|
|
|
:smacks-head: Of course, why didn't I understand that when I first saw your initial post?
Well, judging from your images, they're simply 10x10 blocks, with (the right-hand) 1/2 filled with characters. If you were to assume the windows co-ord system (the one your using when outputting to the console), where by (0,0) is at the top left of the screen, with (width-1, height-1) being at the bottom right you could view the problem like so:
Image 1: draw line from (0,0) to (9,9) - fill in any pixels to the right of this line up to X=9
Image 2: draw line from (9,0) to (0,0) - fill in any pixels to the right of this line up to X=9
You need to animate between the two.
---
(1) Since the block is 10 stars wide, you'll need 10 frames
(2) The middle frame would be - draw line from (4,0) to (4,9) - a vertical line.
Hmm perhaps we could run a 10 iter loop -
iterNum = 0 .. 9
x1 = iterNum
y1 = 0
x2 = 9-iterNum
y2 = 9
FillBetweenAndToRightOf(x1,y2, x2,y2)
endLoop
You'll obviously have to come up with the FillBetweenAndToRightOf function yourself.
Your above tricks won't work when it comes to determining how many spaces to print before you start printing * characters, this time you'll need to calculate the gradient of the line
Recall that gradient = rise/run.
For img1, your X pos varies by 10(from 0-9), as the Y pos changes by 10(from 0-9). Therefore the gradient is 10/10 = 1.
You can then multiply the gradient by the Y pos, add this to X1 to find the first * character on the line. E.g row 4 (0 based) 4*1 + 0 = 4.
For img2, your X pos varies by -10 as the Y pos changes by 10. This time the gradient is -10/10 = -1
E.g row 4 (0 based) 4*-1 + 9 = 5.
Simply draw the figure 10 times with changing values of x1 and x2, using the above formulas to calculate where to start and how many stars to draw on each line.
|
|
|
|
|
tnx alot for your help
i must work on it and tell you again.
tnx
|
|
|
|
|
Rotating on which axis?
"One man's wage rise is another man's price increase." - Harold Wilson
"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
"Show me a community that obeys the Ten Commandments and I'll show you a less crowded prison system." - Anonymous
|
|
|
|
|
hello
in -X axis
tnx alot
|
|
|
|
|
X-axis meaning horizontal? Are wanting it to rotate top over bottom? Which of the 10 rows (of the triangle) will be the pivot point? How many rotations are there between triangle 1 and triangle 2?
"One man's wage rise is another man's price increase." - Harold Wilson
"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
"Show me a community that obeys the Ten Commandments and I'll show you a less crowded prison system." - Anonymous
|
|
|
|
|
*********
********
*******
******
*****
****
***
**
*
#include <iostream>
using namespace std;
int main()
{
for (int r=10; r>1; r--)
{
for (int c=r; c>1; c--)
cout<<" ";
for(int p=r;p>1;p--)
cout<<"*";
cout<<endl;
}
|
|
|
|