|
Well, use Chris Maunders DIBSection wrapper and you'll have a bitmap you can treat as a HBITMAP, but also iterate through the bits directly.
Christian
After all, there's nothing wrong with an elite as long as I'm allowed to be part of it!! - Mike Burston Oct 23, 2001
Sonork ID 100.10002:MeanManOzI live in Bob's HungOut now
|
|
|
|
|
Do someone know why if I put a socket listening using:
listen(MyServerSocket, 1); // Accept ONLY 1 connection
and then try to connect to this socket with 2 applications (at the same time) both connect ?!?!?!?
The first application that connects can send and receive bytes, while the second application cannot send/receive anything.
I've tried various socket examples (included some found on the MSDN and Microsoft website) but all of them have this problem.
Any clue?
Thanks very much in advance for any help!!!!!!!
SoftechSoftware
Davide Calabro'
davide_calabro@yahoo.com
http://www.softechsoftware.it
|
|
|
|
|
you have specified a backlog of 1
This means when there is one existing connection,one more connection is possible.
An ideal situation would have been to be able to specify a backlog of zero. Unfortunately if you use zero it is reset to 1 automatically and I really dont know why this is so.
I had similar situations often where I wanted only one connection. What I finally did was to set a flag and if the flag was true whenever a new connection came I closed the socket. I allowed a connection only when the flag was false. It's a silly work-around but that's the way it works.
Nish
Sonork ID 100.9786 voidmain
www.busterboy.org
Nish is a BIG fan of Goran Ivanisevic
|
|
|
|
|
Thanks very much for your help!
SoftechSoftware
Davide Calabro'
davide_calabro@yahoo.com
http://www.softechsoftware.it
|
|
|
|
|
Hi
I am using the following function to send a mail.
In a normal exe if I use it it works properly.But I have converted my application into a service.
Then in the following function connect function fails and WSAGetLastError returns error WSAECONNREFUSED.
int CSMTP::SMTPSendMail(char *lpszMail)
{
char szHostName[100];
SOCKET sSock;
bool bData = FALSE;
int iErr;
char szSendBuf[1000];
char szRecvBuf[2000];
int iSend = 0;
int iCount = 0;
int PORT=25;
DWORD dwRecCount = 0 ;
char * SMTPCOMMANDS[]={"HELO", "MAIL FROM:","RCPT TO:", "DATA", "QUIT"};
// Default Time Out Values See RFC 1123.Sec.5.3.1
DWORD TimeOut[6]={18000000,18000000,18000000,7200000,10800000,36000000};
DWORD dwSndTO = 90000;
gethostname(szHostName,100);
try
{
SOCKADDR_IN SendSock;
SendSock.sin_family=AF_INET;
SendSock.sin_addr.s_addr= m_dwServerIP;
SendSock.sin_port=htons(PORT);
if ( (sSock=socket(AF_INET,SOCK_STREAM,0))==INVALID_SOCKET)
{
wsprintf(m_szErrorMsg,"SMTPSendMail::Socket creation failed");
return -1;
}
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// Connect and Get Greeting SMTP ERROR CODE Success == 220 Failure = 421
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
if ((iErr=connect(sSock,( const struct sockaddr FAR *)&SendSock,sizeof (SendSock)))==SOCKET_ERROR)
{
wsprintf(m_szErrorMsg,"Connect Attempt failed to %s Server",m_lpszMailServer);
int code = WSAGetLastError (); // returns WSAECONNREFUSED
closesocket(sSock);
return -1;
}
iErr = setsockopt(sSock,SOL_SOCKET, SO_RCVTIMEO ,(char *)&TimeOut[0],sizeof(TimeOut[0]));
iErr = setsockopt(sSock,SOL_SOCKET, SO_SNDTIMEO ,(char *)&dwSndTO,sizeof(dwSndTO));
ZeroMemory(szRecvBuf,2000);
iErr = 0 ;
iCount = 0;
...
...
...
}
What is the problem?
Please help.
Thanks in advance.
rgds
Venkatesh
|
|
|
|
|
Hello, the codegurus around the world.;)
I don't understand the meaning of Win32 Service?
I think that you use the blocking socket, and WSAGetLastError() simple
gets the last error of the socket operation.
This means that even though you put on WSAGetLastError() in connect,
the other process, for example, gets the result of connect, and get to
the requirement of the user id and password of the email, this WSAGetLastError () may get another error generated the operation except connect().
Or, maybe Win32 Service has the conflict with your socket operation.
Please, don't send me your email about your questions directly.
Have a nice day!
Sonork - 100.10571:vcdeveloper
-Masaaki Onishi-
|
|
|
|
|
Hi,
I want to create a modeless dialog ( create, show...), but I don´t what is the correct way to avoid leakages when closing the dialog, or destroyin or... should I notify the parent that the modeless dialog has been closed to call there DestroyWindow, or... ?
Thanks, Bye !
Braulio
|
|
|
|
|
In MFC, you override PostNcDestroy() and call delete this . In ATL, it's supposed to be similar, but I'm writing code at the moment that has a modeless dialog and the docs seem to be wrong. I just posted about this, so keep an eye on that post too.
--Mike--
http://home.inreach.com/mdunn/
While I can't be correct on all matters, I can make the reassuring claim that where I am inaccurate, I am at least definitively inaccurate.
your with and
Sonork - 100.10414 AcidHelm
|
|
|
|
|
i have declared a combobox (CComboBox m_selector)under my CMainFrm class in MDI environment. but in MyAppView class i need to use the m_selector to get its current selection
(m_selector.GetCurSel()).
i dunt know how to go about referring the mainfrm to the myappview so that i can work on the combobox in the myappview class.
pls help
|
|
|
|
|
Use the AfxGetMainWnd() for get pointer to the MainFrame.
Best regards,
Eugene Pustovoyt
|
|
|
|
|
so sorry because i am a beginner to vc++
how do i actually code that in under myappview class?
actually i need to code something in myappclass which require the combobox declared in the mainframe class
for example if i do it in mainframe.c, will be
int selector m_selector.GetCurSel();
but now i wish to do it in myappview.c, with the combobox declared in mainframe.h
how can i code it as above?
thanks for help
|
|
|
|
|
Try next...
1. Include to the ...View.cpp file next string
#include "MainFrm.h"
2. When needed add next...
CMainFrame * pFrame = (CMainFrame*)AfxGetMainWnd();
int selector = pFrame->m_selector.GetCurSel();
Note, than m_selector MUST be public variable.
Best regards,
Eugene Pustovoyt
|
|
|
|
|
Hello,
I have an app which uses GetCurrentDirectory().
Works fine when I start it up by typing its name on the command line.
BUT
when I start up the app (being an OLE server) via DCOM (Invoke by another program the OLE client) it always returns "C:\" as the current directory unless it runs in "C:\Program Files\anotherDir\Dir2".
I experience this problem particularly on Windows 98.
Does anyone out there have the same experience?
Is there an explanation for this behaviour?
How to 'solve' this?
Thanks in advance.
Geert.
|
|
|
|
|
use GetModuleFileName instead
Nish
Sonork ID 100.9786 voidmain
www.busterboy.org
Nish is a BIG fan of Goran Ivanisevic
|
|
|
|
|
Hi Nish,
Thanks for answering.
This indeed works. But you have to admit: it's a workaround.
You have to strip the file name and the backslash to get the directory.
I just want to know why the function GetCurrentDirectory() doesn't simply do what it is intended for: "retrieving the current directory for the current process" as MSDN states.
Geert.
|
|
|
|
|
You're missing the point: GetCurrentDirectory() is indeed for "retrieving the current directory for the current process", and it works as such.
Imagine a console program that calls GetCurrentDirectory, and displays the output to the console. Put this program in c:\myprojects\test\test.exe
Then, from a command prompt, in c:\windows, type "c:\myprojects\test\test.exe" . The output will display c:\windows. Because the current directory is not the same as the directory that the executable resides in.
Sorry to dissapoint you all with my lack of a witty or poignant signature.
|
|
|
|
|
GetCurrentDirectory is an often misunderstood API call. It can only return the current directory for the process as the OS reports it. I mean there is no point in GetCurrentDirectory returning the application exe directory if the current directory is different huh? Think about it this way. You run c:\abc.exe. Now GetCurrentDirectory should return c:\ if you have run it from c:\
Now imagine this :-
somewhere you give a SetCurrentDirectory("d:\")
Now from what you said, it would seem as if you still expect GetCurrentDirectory to return c:\ when it should actually return d:\ which is what it does.
Nish
Sonork ID 100.9786 voidmain
www.busterboy.org
Nish is a BIG fan of Goran Ivanisevic
|
|
|
|
|
Hi guys,
Thanks for clarifying this.
I indeed confused 'current directory' with 'directory the app is in'.
In fact for what I want I don't need GetCurrentDirectory().
Nish, you're right, I should use GetModuleFileName().
Thank you.
Geert.
|
|
|
|
|
Hello guys,
I have two toolbar, but when they are created, they are place one under the other. I would align them on the same row. How can I do that?.
Thank you.
Giancarlo
|
|
|
|
|
Create a CReBar and add your toolbars to the rebar.
By default they'll be on the same line.
If you want them on separate lines you'll need to use RBBS_BREAK flag explicitly when adding the toolbars to the rebar
Nish
Sonork ID 100.9786 voidmain
www.busterboy.org
Nish is a BIG fan of Goran Ivanisevic
|
|
|
|
|
Have a look at my CGSToolbar class on CP - it shows you how to put them in a row without having to lose floatability ( rebars do not float ).
Christian
After all, there's nothing wrong with an elite as long as I'm allowed to be part of it!! - Mike Burston Oct 23, 2001
Sonork ID 100.10002:MeanManOzI live in Bob's HungOut now
|
|
|
|
|
Hi All...
Pls Help me to resolve this problem...
I want to Give Filter Command in a File Dialog...
I could give one Line in that Combo Box..How can I Insert more that One line In that Combo Box
Thanks in Advance
|
|
|
|
|
Hello,
Each line should be shared by a character - "| ", and last ast to come to an end a double character "|| "
Best regards
Eugene Pustovoyt
|
|
|
|
|
Is anyone to able send me a working example of this article?
http://msdn.microsoft.com/library/en-us/sysinfo/regapi_0tq1.asp?frame=true
Unfortunly, I know C++ to bad to compile it myself.
Thanks a lot!
PS. sorry for my english.
==============
www.design.kg
|
|
|
|
|
All you need to do is create a dialog class that contains the appropriately named list boxes and copy and paste this function. If you're not capable of that you should NOT be touching code that plays with the registry.
If you really can't create a dialog based project and copy/paste some code, I'd be happy to advise you, but I'm serious about how seriously you can screw Windows if you play with the Registry and don't know what you're doing.
Christian
After all, there's nothing wrong with an elite as long as I'm allowed to be part of it!! - Mike Burston Oct 23, 2001
Sonork ID 100.10002:MeanManOzI live in Bob's HungOut now
|
|
|
|