MFC Sockets Query?

Hi experts
This is my first experience with Sockets Programming.
I am purely using MFC on both sides -- Server(Dialog based application with
3 buttons <Start server, Send data & shutdown server>).
The client application is an Windows explorer type MFC SDI application.

After the connection is established & when the <Send data> button is clicked
on the server side, names of all the folders in C:\ is send one by one to
the client for display in the tree view.

Now i have 2 questions to ask:

Q1--> How can i make sure that the Port No. that i will provide in the
Create() will be to create socket on each & every system?


Q2--> Now suppose the data ie folder names are being send from server to
client & in the mean time i purposely pulls out the network cable. Now under
such circumstances how wud the client know that the connection with the
server is disrupted & no more data transfer cud take place?

waiting for suggestions

Regards




0
davinder1 (74)
2/28/2005 6:21:14 AM
vc.mfc 33608 articles. 0 followers. Follow

7 Replies
830 Views

Similar Articles

[PageSpeed] 42

Q1: Go to www.iana.org, hyperlink around for a while, and find the form for applying for a
registered port number. FIll it in. Wait a few weeks. You will be assigned a port number.

This is a different question than the one you asked. If you do a Create() with a port
number, that is the port number that will be used. If it is already in use by another
program for another purpose, the Create will fail. But if you have a registered port
number, you can point out to the end user that the other program is defective because it
is using your port number, which it has no right to do.

Q2: You should get an error. As long as you are using TCP/IP and not UDP, someone will
eventually time out and return an error. THis has nothing to do with fact that data is a
folder name, or anything else about the data. TCP/IP does not care about the content in
the slightest. 

Now as to how you recover from the error, or restart the communication, well, that's up to
you.
				joe

On Mon, 28 Feb 2005 11:51:14 +0530, "davinder" <davinder@stellarinfo.com> wrote:

>Hi experts
>This is my first experience with Sockets Programming.
>I am purely using MFC on both sides -- Server(Dialog based application with
>3 buttons <Start server, Send data & shutdown server>).
>The client application is an Windows explorer type MFC SDI application.
>
>After the connection is established & when the <Send data> button is clicked
>on the server side, names of all the folders in C:\ is send one by one to
>the client for display in the tree view.
>
>Now i have 2 questions to ask:
>
>Q1--> How can i make sure that the Port No. that i will provide in the
>Create() will be to create socket on each & every system?
>
>
>Q2--> Now suppose the data ie folder names are being send from server to
>client & in the mean time i purposely pulls out the network cable. Now under
>such circumstances how wud the client know that the connection with the
>server is disrupted & no more data transfer cud take place?
>
>waiting for suggestions
>
>Regards
>
>
>

Joseph M. Newcomer [MVP]
email: newcomer@flounder.com
Web: http://www.flounder.com
MVP Tips: http://www.flounder.com/mvp_tips.htm
0
newcomer (15972)
3/1/2005 11:56:30 AM
Hi
Thanx for ur suggestions, they are extremly helpful.
Best Regards
Davinder


"Joseph M. Newcomer" <newcomer@flounder.com> wrote in message
news:ssl821durbuj59qdu4aolet44ng36uf4qd@4ax.com...
> Q1: Go to www.iana.org, hyperlink around for a while, and find the form
for applying for a
> registered port number. FIll it in. Wait a few weeks. You will be assigned
a port number.
>
> This is a different question than the one you asked. If you do a Create()
with a port
> number, that is the port number that will be used. If it is already in use
by another
> program for another purpose, the Create will fail. But if you have a
registered port
> number, you can point out to the end user that the other program is
defective because it
> is using your port number, which it has no right to do.
>
> Q2: You should get an error. As long as you are using TCP/IP and not UDP,
someone will
> eventually time out and return an error. THis has nothing to do with fact
that data is a
> folder name, or anything else about the data. TCP/IP does not care about
the content in
> the slightest.
>
> Now as to how you recover from the error, or restart the communication,
well, that's up to
> you.
> joe
>
> On Mon, 28 Feb 2005 11:51:14 +0530, "davinder" <davinder@stellarinfo.com>
wrote:
>
> >Hi experts
> >This is my first experience with Sockets Programming.
> >I am purely using MFC on both sides -- Server(Dialog based application
with
> >3 buttons <Start server, Send data & shutdown server>).
> >The client application is an Windows explorer type MFC SDI application.
> >
> >After the connection is established & when the <Send data> button is
clicked
> >on the server side, names of all the folders in C:\ is send one by one to
> >the client for display in the tree view.
> >
> >Now i have 2 questions to ask:
> >
> >Q1--> How can i make sure that the Port No. that i will provide in the
> >Create() will be to create socket on each & every system?
> >
> >
> >Q2--> Now suppose the data ie folder names are being send from server to
> >client & in the mean time i purposely pulls out the network cable. Now
under
> >such circumstances how wud the client know that the connection with the
> >server is disrupted & no more data transfer cud take place?
> >
> >waiting for suggestions
> >
> >Regards
> >
> >
> >
>
> Joseph M. Newcomer [MVP]
> email: newcomer@flounder.com
> Web: http://www.flounder.com
> MVP Tips: http://www.flounder.com/mvp_tips.htm


0
davinder1 (74)
3/2/2005 6:49:04 AM
Hi
There is one more problem that i m facing.
I have a <shutdown> button on the dialog box of my server application.
Now at the time the data transfer between server & client is taking place &
i try to shut down the server application by clicking on the <shutdown>
button, nothing happens.

It is only after the data transfer is complete the server shuts down.

How can i rectify this.
I want to have the ability of shutting down the server at any time i want.

Waiting for suggestions

Best Regards
Davinder


"davinder" <davinder@stellarinfo.com> wrote in message
news:#$rw0PvHFHA.1392@TK2MSFTNGP10.phx.gbl...
> Hi
> Thanx for ur suggestions, they are extremly helpful.
> Best Regards
> Davinder
>
>
> "Joseph M. Newcomer" <newcomer@flounder.com> wrote in message
> news:ssl821durbuj59qdu4aolet44ng36uf4qd@4ax.com...
> > Q1: Go to www.iana.org, hyperlink around for a while, and find the form
> for applying for a
> > registered port number. FIll it in. Wait a few weeks. You will be
assigned
> a port number.
> >
> > This is a different question than the one you asked. If you do a
Create()
> with a port
> > number, that is the port number that will be used. If it is already in
use
> by another
> > program for another purpose, the Create will fail. But if you have a
> registered port
> > number, you can point out to the end user that the other program is
> defective because it
> > is using your port number, which it has no right to do.
> >
> > Q2: You should get an error. As long as you are using TCP/IP and not
UDP,
> someone will
> > eventually time out and return an error. THis has nothing to do with
fact
> that data is a
> > folder name, or anything else about the data. TCP/IP does not care about
> the content in
> > the slightest.
> >
> > Now as to how you recover from the error, or restart the communication,
> well, that's up to
> > you.
> > joe
> >
> > On Mon, 28 Feb 2005 11:51:14 +0530, "davinder"
<davinder@stellarinfo.com>
> wrote:
> >
> > >Hi experts
> > >This is my first experience with Sockets Programming.
> > >I am purely using MFC on both sides -- Server(Dialog based application
> with
> > >3 buttons <Start server, Send data & shutdown server>).
> > >The client application is an Windows explorer type MFC SDI application.
> > >
> > >After the connection is established & when the <Send data> button is
> clicked
> > >on the server side, names of all the folders in C:\ is send one by one
to
> > >the client for display in the tree view.
> > >
> > >Now i have 2 questions to ask:
> > >
> > >Q1--> How can i make sure that the Port No. that i will provide in the
> > >Create() will be to create socket on each & every system?
> > >
> > >
> > >Q2--> Now suppose the data ie folder names are being send from server
to
> > >client & in the mean time i purposely pulls out the network cable. Now
> under
> > >such circumstances how wud the client know that the connection with the
> > >server is disrupted & no more data transfer cud take place?
> > >
> > >waiting for suggestions
> > >
> > >Regards
> > >
> > >
> > >
> >
> > Joseph M. Newcomer [MVP]
> > email: newcomer@flounder.com
> > Web: http://www.flounder.com
> > MVP Tips: http://www.flounder.com/mvp_tips.htm
>
>


0
davinder1 (74)
3/2/2005 7:14:55 AM
davinder wrote:
> Hi
> There is one more problem that i m facing.
> I have a <shutdown> button on the dialog box of my server application.
> Now at the time the data transfer between server & client is taking place &
> i try to shut down the server application by clicking on the <shutdown>
> button, nothing happens.
> 
> It is only after the data transfer is complete the server shuts down.
> 
> How can i rectify this.
> I want to have the ability of shutting down the server at any time i want.
> 
> Waiting for suggestions
> 
> Best Regards
> Davinder

There are two kinds of sockts: blocking and nonblocking.  In MFC they 
are represented by CSocket and CAsyncSocket.

If you use a blocking socket (CSocket) in your main GUI thread then your 
code is probably in a loop while sending or receiving.  But looping in 
the GUI thread causes you to ignore user input!

If you use a nonblocking socket (CAsyncSocket) you can send and receive 
in an event-driven fashion so you don't have to loop.  So you can also 
continue to process user input.

CAsyncSocket is much preferred.  It is harder to use, but it integrates 
much better with a GUI application.

-- 
Scott McPhillips [VC++ MVP]

0
Scott
3/2/2005 1:55:55 PM
It sounds like you are using synchronous sockets. This is one of the many reasons
synchronous sockets (CSocket) are a Fundamentally Bad Idea.  So the most important thing
you can do is rewrite your code to use asynchronous sockets. Then the shutdown becomes
tirivial, and should be obvious once you've rewritten the code.
					joe

On Wed, 2 Mar 2005 12:44:55 +0530, "davinder" <davinder@stellarinfo.com> wrote:

>Hi
>There is one more problem that i m facing.
>I have a <shutdown> button on the dialog box of my server application.
>Now at the time the data transfer between server & client is taking place &
>i try to shut down the server application by clicking on the <shutdown>
>button, nothing happens.
>
>It is only after the data transfer is complete the server shuts down.
>
>How can i rectify this.
>I want to have the ability of shutting down the server at any time i want.
>
>Waiting for suggestions
>
>Best Regards
>Davinder
>
>
>"davinder" <davinder@stellarinfo.com> wrote in message
>news:#$rw0PvHFHA.1392@TK2MSFTNGP10.phx.gbl...
>> Hi
>> Thanx for ur suggestions, they are extremly helpful.
>> Best Regards
>> Davinder
>>
>>
>> "Joseph M. Newcomer" <newcomer@flounder.com> wrote in message
>> news:ssl821durbuj59qdu4aolet44ng36uf4qd@4ax.com...
>> > Q1: Go to www.iana.org, hyperlink around for a while, and find the form
>> for applying for a
>> > registered port number. FIll it in. Wait a few weeks. You will be
>assigned
>> a port number.
>> >
>> > This is a different question than the one you asked. If you do a
>Create()
>> with a port
>> > number, that is the port number that will be used. If it is already in
>use
>> by another
>> > program for another purpose, the Create will fail. But if you have a
>> registered port
>> > number, you can point out to the end user that the other program is
>> defective because it
>> > is using your port number, which it has no right to do.
>> >
>> > Q2: You should get an error. As long as you are using TCP/IP and not
>UDP,
>> someone will
>> > eventually time out and return an error. THis has nothing to do with
>fact
>> that data is a
>> > folder name, or anything else about the data. TCP/IP does not care about
>> the content in
>> > the slightest.
>> >
>> > Now as to how you recover from the error, or restart the communication,
>> well, that's up to
>> > you.
>> > joe
>> >
>> > On Mon, 28 Feb 2005 11:51:14 +0530, "davinder"
><davinder@stellarinfo.com>
>> wrote:
>> >
>> > >Hi experts
>> > >This is my first experience with Sockets Programming.
>> > >I am purely using MFC on both sides -- Server(Dialog based application
>> with
>> > >3 buttons <Start server, Send data & shutdown server>).
>> > >The client application is an Windows explorer type MFC SDI application.
>> > >
>> > >After the connection is established & when the <Send data> button is
>> clicked
>> > >on the server side, names of all the folders in C:\ is send one by one
>to
>> > >the client for display in the tree view.
>> > >
>> > >Now i have 2 questions to ask:
>> > >
>> > >Q1--> How can i make sure that the Port No. that i will provide in the
>> > >Create() will be to create socket on each & every system?
>> > >
>> > >
>> > >Q2--> Now suppose the data ie folder names are being send from server
>to
>> > >client & in the mean time i purposely pulls out the network cable. Now
>> under
>> > >such circumstances how wud the client know that the connection with the
>> > >server is disrupted & no more data transfer cud take place?
>> > >
>> > >waiting for suggestions
>> > >
>> > >Regards
>> > >
>> > >
>> > >
>> >
>> > Joseph M. Newcomer [MVP]
>> > email: newcomer@flounder.com
>> > Web: http://www.flounder.com
>> > MVP Tips: http://www.flounder.com/mvp_tips.htm
>>
>>
>

Joseph M. Newcomer [MVP]
email: newcomer@flounder.com
Web: http://www.flounder.com
MVP Tips: http://www.flounder.com/mvp_tips.htm
0
newcomer (15972)
3/2/2005 5:10:46 PM
Hi
 Thanx for ur advise. I m now using CAsyncSocket as a result of which my
problem is solved.

Thanx again
Best Regards
Davinder

"Scott McPhillips [MVP]" <org-dot-mvps-at-scottmcp> wrote in message
news:esmPhAzHFHA.3040@TK2MSFTNGP10.phx.gbl...
> davinder wrote:
> > Hi
> > There is one more problem that i m facing.
> > I have a <shutdown> button on the dialog box of my server application.
> > Now at the time the data transfer between server & client is taking
place &
> > i try to shut down the server application by clicking on the <shutdown>
> > button, nothing happens.
> >
> > It is only after the data transfer is complete the server shuts down.
> >
> > How can i rectify this.
> > I want to have the ability of shutting down the server at any time i
want.
> >
> > Waiting for suggestions
> >
> > Best Regards
> > Davinder
>
> There are two kinds of sockts: blocking and nonblocking.  In MFC they
> are represented by CSocket and CAsyncSocket.
>
> If you use a blocking socket (CSocket) in your main GUI thread then your
> code is probably in a loop while sending or receiving.  But looping in
> the GUI thread causes you to ignore user input!
>
> If you use a nonblocking socket (CAsyncSocket) you can send and receive
> in an event-driven fashion so you don't have to loop.  So you can also
> continue to process user input.
>
> CAsyncSocket is much preferred.  It is harder to use, but it integrates
> much better with a GUI application.
>
> --
> Scott McPhillips [VC++ MVP]
>


0
davinder1 (74)
3/3/2005 10:28:11 AM
Hi
I m using CAsyncSocket thus asynchronous sockets.
Thanx for the suggestions.

Best Regards
Davinder


"Joseph M. Newcomer" <newcomer@flounder.com> wrote in message
news:vosb21d5jdradqe7u0j6lc007sfqqpmnrv@4ax.com...
> It sounds like you are using synchronous sockets. This is one of the many
reasons
> synchronous sockets (CSocket) are a Fundamentally Bad Idea.  So the most
important thing
> you can do is rewrite your code to use asynchronous sockets. Then the
shutdown becomes
> tirivial, and should be obvious once you've rewritten the code.
> joe
>
> On Wed, 2 Mar 2005 12:44:55 +0530, "davinder" <davinder@stellarinfo.com>
wrote:
>
> >Hi
> >There is one more problem that i m facing.
> >I have a <shutdown> button on the dialog box of my server application.
> >Now at the time the data transfer between server & client is taking place
&
> >i try to shut down the server application by clicking on the <shutdown>
> >button, nothing happens.
> >
> >It is only after the data transfer is complete the server shuts down.
> >
> >How can i rectify this.
> >I want to have the ability of shutting down the server at any time i
want.
> >
> >Waiting for suggestions
> >
> >Best Regards
> >Davinder
> >
> >
> >"davinder" <davinder@stellarinfo.com> wrote in message
> >news:#$rw0PvHFHA.1392@TK2MSFTNGP10.phx.gbl...
> >> Hi
> >> Thanx for ur suggestions, they are extremly helpful.
> >> Best Regards
> >> Davinder
> >>
> >>
> >> "Joseph M. Newcomer" <newcomer@flounder.com> wrote in message
> >> news:ssl821durbuj59qdu4aolet44ng36uf4qd@4ax.com...
> >> > Q1: Go to www.iana.org, hyperlink around for a while, and find the
form
> >> for applying for a
> >> > registered port number. FIll it in. Wait a few weeks. You will be
> >assigned
> >> a port number.
> >> >
> >> > This is a different question than the one you asked. If you do a
> >Create()
> >> with a port
> >> > number, that is the port number that will be used. If it is already
in
> >use
> >> by another
> >> > program for another purpose, the Create will fail. But if you have a
> >> registered port
> >> > number, you can point out to the end user that the other program is
> >> defective because it
> >> > is using your port number, which it has no right to do.
> >> >
> >> > Q2: You should get an error. As long as you are using TCP/IP and not
> >UDP,
> >> someone will
> >> > eventually time out and return an error. THis has nothing to do with
> >fact
> >> that data is a
> >> > folder name, or anything else about the data. TCP/IP does not care
about
> >> the content in
> >> > the slightest.
> >> >
> >> > Now as to how you recover from the error, or restart the
communication,
> >> well, that's up to
> >> > you.
> >> > joe
> >> >
> >> > On Mon, 28 Feb 2005 11:51:14 +0530, "davinder"
> ><davinder@stellarinfo.com>
> >> wrote:
> >> >
> >> > >Hi experts
> >> > >This is my first experience with Sockets Programming.
> >> > >I am purely using MFC on both sides -- Server(Dialog based
application
> >> with
> >> > >3 buttons <Start server, Send data & shutdown server>).
> >> > >The client application is an Windows explorer type MFC SDI
application.
> >> > >
> >> > >After the connection is established & when the <Send data> button is
> >> clicked
> >> > >on the server side, names of all the folders in C:\ is send one by
one
> >to
> >> > >the client for display in the tree view.
> >> > >
> >> > >Now i have 2 questions to ask:
> >> > >
> >> > >Q1--> How can i make sure that the Port No. that i will provide in
the
> >> > >Create() will be to create socket on each & every system?
> >> > >
> >> > >
> >> > >Q2--> Now suppose the data ie folder names are being send from
server
> >to
> >> > >client & in the mean time i purposely pulls out the network cable.
Now
> >> under
> >> > >such circumstances how wud the client know that the connection with
the
> >> > >server is disrupted & no more data transfer cud take place?
> >> > >
> >> > >waiting for suggestions
> >> > >
> >> > >Regards
> >> > >
> >> > >
> >> > >
> >> >
> >> > Joseph M. Newcomer [MVP]
> >> > email: newcomer@flounder.com
> >> > Web: http://www.flounder.com
> >> > MVP Tips: http://www.flounder.com/mvp_tips.htm
> >>
> >>
> >
>
> Joseph M. Newcomer [MVP]
> email: newcomer@flounder.com
> Web: http://www.flounder.com
> MVP Tips: http://www.flounder.com/mvp_tips.htm


0
davinder1 (74)
3/3/2005 10:29:35 AM
Reply:

Similar Artilces:

A strange problem with MFC
Hi, Rencently I met a strange problem. The code like below: CWinThread* pThread = AfxBeginThread(ThreadFunc, (LPVOID)this, THREAD_PRIORITY_NORMAL, 0, CREATE_SUSPENDED); if(pThread->m_hThread != NULL){ pThread->m_bAutodelete = FALSE; pThread->ResumeThread(); } After the statement "pThread->m_bAutodelete = FALSE" executed, I found the value of pThread->m_hThread is 0. While pThread->m_bAutodelete is still 1! The code section located in a win32 static library, with /Md option.The host application(exe) is a win32 console application, with /Md option. There...

iFrame and ASPX based SQL Query
We would like to view the output of a sql query in an iFrame via another webpage. How can I pass a crm variable like crmForm.all.name.value to the SQL query so that it only pulls records for the particular customer that I am viewing. Do I pass this variable to SQL or pass the SQL select to the CRM iFrame variable? Could anyone give me a quick example for the onLoad event? Thanks, Rob Hi, You can pass GUID of the entity to the IFrame and than using that GUID, you can fetch from CRM any attribute you want using CRM SDK. http://ayazahmad.wordpress.com/2007/02/23/how-to-pass-entity-gui...

Update a table from a query
Hello All, I am trying to update a table using a query. I keep getting "Operation must use an updateable query". I am not an SQL expert. I just sort of muddle through. My update query is this: UPDATE DISTINCTROW CostSummarySheet INNER JOIN qryUpdateTotalUsed3 ON (CostSummarySheet.CNS_Num = qryUpdateTotalUsed3.CostCNS) AND (CostSummarySheet.Proj_Num = qryUpdateTotalUsed3.PROJ_NUM) SET CostSummarySheet.Tot_Used = [qryUpdateTotalUsed3]![SumOf$$] WHERE (((CostSummarySheet.CNS_Num)=[qryUpdateTotalUsed3].[CostCNS]) AND ((CostSummarySheet.Proj_Num)=[qryUpdateTotalUsed3]...

Input box query
I am hoping to use a inputbox to have the user type in the 6 digit number each client has been assigned. I would like for the ability for excel to see this number and go to the corresponding sheet with this number. The number is place in cell "d1" Is this possible TIA Greg I would do this with putting the code below to the sheet where you hav the cell "d1". Private Sub Worksheet_Change(ByVal Target As Range) On Error GoTo EXITSUB: Select Case Range("$D$1").Value Case "1" Sheets(2).Select Case "2" Sheets(3).Select End Select EXITSUB: En...

Unicode in MFC
Hi, I am new to MFC programming and I have a problem: when I try to write the caption of a button or something else in my own language(Farsi), in the design mode it shows the correct string but when I compile it it shows a '?' instead of every character. Can anyone please help me with that. > I am new to MFC programming and I have a problem: > when I try to write the caption of a button or something else in my > own language(Farsi), in the design mode it shows the correct string > but when I compile it it shows a '?' instead of every character. Can > anyone ple...

Access 2003 Printing Query Parameter values onto your report.
I have added the following to my report: (Note: I have a parameter set in my query for data to display between two dates) I added 2 text boxs to my report header (1 for the start date and 1 for the end date): Label: Start Date Text box: =Reports![rptTest]![Enter Start Date] Label: End Date =Reports![rptTest]![Enter End Date] Once I run the report I have to enter the query parameter and then the report pops up the with Start and End Date and then the date stores in my text box, however, I have to...

return int value to OS in MFC App
Hi, Everybody. I have to make A MFC app to return int value to Operatiing System.. if i could use WinMain() function, this is not matter. but MFC does not reveal WinMain().... How can i solve this problem? Can Anybody help me with this problem? <flybluewing@bcline.com> wrote in message news:1189386249.923483.59250@y42g2000hsy.googlegroups.com... > Hi, Everybody. > > I have to make A MFC app to return int value to Operatiing System.. > > if i could use WinMain() function, this is not matter. > but MFC does not reveal WinMain().... > How can i solve this problem?...

Parameter Value Query in Report
Hi,I'm designing my first database and have run into the following problem;In a report I am designing I would like to have a calculation at the end of the report that multiplies a sum that has been calculated in the same report with a value that has been calculated by a specific query I have designed.In the text box in the report I have the following expression: =[Sum Of NormalTime]*[Full Salary Adjustment List]![Net NT HR]When I try to view the report in the Normal View the report asks me to enter parameter values for the Query from which I have taken specific values for the above mention...

mfc and IE activeX
I'm using VS 2003 and trying to use Internet Explorer in my MFC application but encountering problems If I built a very simple test dialog-application and drop in the IE it works exactly as expected. However, when I create a similar dialog box in my MFC application and call the ...DoModal() nothing appears at all - not even the dialog box itself. It's as if my application does not want to use ActiveX components - I also tried a couple of other Microsoft ActiveX controls and they have the same problem. I must be missing something obvious - any one with any ideas will be much ...

Update Query
How do I create an update query to automatically assign the create date of 9/24/2009 as the end date for for the record with the create date of 9/15/09. ID CATEGORY DURATION CREATE_DATE END_DATE 2381 Service 13 - 24 months 9/15/2009 9:35:00 AM 2381 Service 13 - 24 months 9/24/2009 12:41:00 PM The SQL for what you asked would look like the following. UPDATE SomeTable Set End_Date = #2009-09-24# WHERE Create_Date >=#2009-09-15# and Create_Date < #2009-09-16# AND End_Date is Null However, what I think you are asking is how to do this for...

ActiveX Socket
I am developing an activex control with a TCP/IP socket. The activex control is written using vc++/mfc and the socket part is using CAsyncSocket class support of MFC. I am unable to connect to a server as I get WSAStartup not called 10093 error code. This is due to the activex test container supporting the control having a different process boundary. The proposed solution seems (and please correct me if I am wrong) to spawn a new thread from the activex control using afxbeginthread and make a connection to the server from this thread. Any comments on whether this will really work ? "High...

Need Help with MFC!!
Hi all, need help esp. with Graphic part. When you right click on any drive on your machine and click properties, you get a tabbed dialog. I want to know how can I embed graphic image (pie chart) into my MFC Dialog? I have written code which displays the Disk Usage right now but don't know how to display that info as a PIE CHART!!!!!! besides what type of MFC Dialog application should I look fwd to build? I want exactly as the DRIVE properties. TIA -- ======== Regards Vai ======== Have you looked at the CDC::Pie method? joe On Wed, 12 May 2004 23:07:11 -0400, "Vai2000"...

duplicate results in query
Hi, I am getting duplicate results when I run a query. Here are the details. Bothe tables have the same data only dates have changed. what I am trying to do is find out which dates have changed. The problem is this. Some purhcase orders are split so the same PO and line has 2 dates. when i combine the 2 tables I get 4 lines for these instead of 2. example Vendor PO Line Qty Date X 1234 1 2 7/1/2010 X 1234 1 2 8/1/2010 When i combine this with the other table which is the same for these I get the followin...

Transpose Microsoft Query
I need to transpose some data that I bring in via a microsoft query, however when I do the copy and special paste it works properly the first time, whenever i update the query, the transposed special paste goes back to the orginal format. Is there anyway to do this? Terry hi how are you updating the query now? how big is it? were are you transposing it? a tad short on details but you might try something like this code. Sub TransposeMSQ() Sheets("Sheet1").Activate Range("A1").QueryTable.Refresh BackgroundQuery = False Range("A1:A50").Copy Ran...

challenging query
I have a table with a code field and a price field. I need to find records where the code field data is the same (I did a duplicate query) Now I need to make a report that shows those duplicates but only if the price field is different. I am trying to show where there are duplicate codes that have different prices -- Thank you On Wed, 3 Mar 2010 23:03:01 -0800, Pellissier <Pellissier@discussions.microsoft.com> wrote: >I have a table with a code field and a price field. >I need to find records where the code field data is the same (I did a >duplicate quer...

MFC to Console.
Hello Group. I need to convert the code of WiniNet Async Demo from microsoft samples from MFC to a console function.. Someone can help me with the changes.. The code is posted here Regards /* Microsoft Corporation Copyright 1999-2002 */ /******************************************************************** ProjectName : AsyncDemo Purpose : This sample demonstrates how to submit two WinInet requests, using InternentOpenUrl, asynchronously. Notes : This sample does not handle any authentication. To properly handle authentication, the functions that handle specific protocols (like Ht...

XML and MFC
Hello guys, What source of knowledge would you point me to if you were about to integrate XML with MFC? Of course if there's any Microsoft documentation anywhere, please post me a link to it. Thank you in advance! :-) Yea, I wanna know it too. Who would give a hand? > What source of knowledge would you point me to if you were about to > integrate XML with MFC? Of course if there's any Microsoft documentation > anywhere, please post me a link to it. After digging left and right, I remained with two main options: - MSXML - MS, proprietary, COM, with all the implications:...

Sending Window Messages from an MFC app to a Windows Firm tray application
Hello, I have an MFC MDI application and a Windows Forms (2.0) Tray Icon application. I want to run a command on the tray application via my MFC application. There is a "Register" context menu command on the tray icon application. I want to call the Register command from my MFC MDI application. I thought of a windows message. How do I do it? Is there any other better mechanism to do so? Thanks, Janiv Ratson. If you know the class of the window on the tray application you can use FindWindow() to get the window for the class. Then you can use either PostMessage() or SendMessag...

dynamically managing of layout in MFC + GridBagLayout in MFC or C++
Hi, can anybody tell me how can I make or find a function in MFC to manage layout of a dialog that dynamically has been create and also the controls in the dialog? I am new in MFC, what I am lokking for is something like GridBagLayout in java? is there something like this in C++ MFC ? any idea plz? Thank u There is nothing like GridBagLayout in MFC. However, you can achieve the same functionality thru various means. You have to move the controls manually on resize of the dialog or window. Please see the following examples: http://www.codeproject.com/dialog/easysize.asp http://www.codepr...

Query, Change Expression if True
ExceptWhere tblHorseDetails.Invoicing is True (Check Box) I am trying to stop this query reconizing any OwnerID, HorseID that is True Thanks for any Help..........Bob SELECT Format(tblHorseDetails.OwnerPercent,"0.0%") AS Expr1, IIf(IsNull(tblOwnerInfo.OwnerLastName),'',tblOwnerInfo.OwnerLastName & ' ') & IIf(IsNull(tblOwnerInfo.OwnerFirstName),'',tblOwnerInfo.OwnerFirstName & ' ') AS OwnerName, tblOwnerInfo.OwnerID, tblHorseDetails.Invoicing FROM tblOwnerInfo, tblHorseDetails WHERE (((tblOwnerInfo.OwnerID)=[tblHorseDetails].[OwnerID]) A...

Database query, spreadsheet size
I have a spreadsheet with several database queries from SQL Server. As queries are refreshed, spreadsheet size continues to grow. Even when I wipe out the queries, the file stays around 300K. Does anyone know where this extra data is sitting and how can I clear it out. Hi 300K is not that big but have a look at: http://www.contextures.com/xlfaqApp.html#Unused >-----Original Message----- >I have a spreadsheet with several database queries from >SQL Server. As queries are refreshed, spreadsheet size >continues to grow. Even when I wipe out the queries, the >file stay...

Console output from MFC dialog based app
Dear All, I have developed a MFC dialog based application. Now when I execute this app from command prompt, I need to write some text back to console. In console application we achieve this using functions like printf(), puts(), etc. Please let me know how do I achieve same in dialog based application since printf() and other functions are not working here. Thanks, Ajay You can't write to the same console window that you were ran from, but you can create a console window and write to that. Take a look at AllocConsole, ReadConsole, and WriteConsole. Here is an example: http://www....

Microsoft Query Criteria Sort Order
We have users who user Microsoft Query to bring data into an Excel spreadsheet. Sometimes they need to set criteria for a field and do so by double clicking the value field on the query form. A dialog box appears showing the field, operator and value. On the right hand side of this dialog box is a box called Values. When you click this box it gives you a list of the distinctive values of the field. Apparently these values used to be in sorted order, but now they come in an order that makes no sense. Does anyone have any idea why this would change? They get similar results cal...

Value in union query
I have used union queries before but since I am not much of a SQL person I am having a little trouble with the following: I have a table called Jobs and I want to return all the values in the job name filed. However I also want to add one more value - a hard coded value called "Manager Override" to the values returned from the job name field. How can you combine values from a table/field with another value (that is hard coded into the union query)? (I am using the results for a combobox). Thanks for any help. -- Message posted via AccessMonster.com http://www.acce...

Reporting back crashes in MFC-based products
Hello, We have a product written in MFC using Visual Studio 7.1. We are now planning to implement a feature that will detect a crash and report to us the cause of the crash and other meaningful information. The plan is to provide something similar to Window's error reporting tool. I found a 3rd party tool for Delphi that instruments the source code. When the program crashes, it provides information like the name of the function, module etc.. Is there something similar that I can use with MFC? The other option is to use MFC's Structured Exception Handling and try to get a memory dump...