|
|
This doesn't do it for some reason. Maybe WM_CANCELMODE IS received synchronically, but TrackPopupMenu() never returns anyhow, before it is too late and the object is deleted - crash .
john
|
|
|
|
|
Hi Everyone, i am still having troule with this over a wan... can anyone shed any light on it for me ?? i am getting kinda desperate now !!
CFtpConnection Thread......
Thanks in advance
Lee
|
|
|
|
|
try to find sample programs in VC disks (MSDN).
FTP is very easy.
|
|
|
|
|
i have done... and the way i have written it works on the local network, but i have a router set up with 3-5 pcs on it and am using port forwarding, if i leave the ftp port at 21 it works fine, if i change the port to anything else i can connect and create folders etc, but cannot do file searches or transfer files... i need to have it on different port as i have upto 5 pcs to forward to...
please help....
|
|
|
|
|
Open your MSDN -> choose Index tab -> Type: FTP Sessions -> Enter
Sincerely
Thangnvhl
|
|
|
|
|
my problem isnt how to use msdn, as i have been programming for 6+ years.. and have used it a fair amount in that time... i have downloaded some sameple programs from this site and they all have the same problem....
|
|
|
|
|
are you forwarding your data port as well?
|
|
|
|
|
i dont know what port the data port is... can i set this up ?? if i use port 21 it works ok...
|
|
|
|
|
Here[^] is a decent explanation.
|
|
|
|
|
Hi,
In a current project I need a class that monitors some maintenance data and regularly writes them to a log file. As this class is used in different modules in different ways, the functions should be encapsulated as best as possible and the usual way of using this class should be by giving a filename to the constructor to configure the instance and then calling Collect() to immediately collect and log the data or calling EnableTimer(time_span) to regularly log the data to the log file every time_span milliseconds.
The problem I can't solve is the timer. My first approach was
<br />
<br />
BOOL CMaintMonitor::EnableTimer(UINT interval)<br />
{<br />
if(bl_TimerEnabled) StopTimer();<br />
bl_TimerEnabled = TRUE;<br />
ui_TimerInterval = interval;<br />
TimerID = SetTimer(NULL, 0, interval, TimerFunction);<br />
if(!TimerID)<br />
{<br />
bl_TimerEnabled = FALSE;<br />
ui_TimerInterval = 0;<br />
return FALSE;<br />
}<br />
return TRUE;<br />
}<br />
<br />
...<br />
<br />
BOOL CMaintMonitor::StopTimer()<br />
{<br />
if(bl_TimerEnabled)<br />
{<br />
bl_TimerEnabled = FALSE;<br />
ui_TimerInterval = 0;<br />
KillTimer(TimerID);<br />
}<br />
return TRUE;<br />
}<br />
TimerFunction was thought as a private method of CMaintMonitor that calls Collect(). Visual C++ didn't like this approach, telling me that it couldn't convert parameter 4 of SetTimer from void(...) to void(__stdcall *)(...). Reading the help pages again I saw that this function is meant to send a WM_TIMER message to a window whose message processing function should call the provided function instead of standard functions, so it still needs a WM_TIMER message processing even if the window handle provided is NULL .
The problem now is that I can't call a global function (I think this is what the compiler wants to say with the (__stdcall *) part of the error message) as Collect is a member function of an instance of CMaintMonitor using instance member data to do its work. So even if I found a way to use a global function for that timer event, I still need a way to give a pointer to my CMaintMonitor instance to that function for the call to Collect(), but I don't see a way to do so.
Can anyone help me solving the problem with that timer? This class should come without a user-Interface, so there is no window I can abuse to handle the timer event, and I can't even use the window of a caller as there are a lot of modules which come without UI either but still need to to use my monitor class. I'm new to programming under Windows, so I don't know if there might be an easy workaround for this problem I just don't know.
Thanks in advance
Martin Dietz
|
|
|
|
|
|
This looks interesting, but I can't find it in my helppages and my compiler doesn't find it neither although I included windows.h (as said in the MSDN article), is it available in Visual C++ 6.0 (sorry I forgot to mention that I'm pinned to that compiler)?
Greetings
Martin
|
|
|
|
|
I was using it with VC6 a few years ago. You need to download the latest SDK from MSDN and make sure to include the header and library file paths in the IDE setup.
[modified] That is "Platform SDK" sorry
led mikeLast modified: Tuesday, August 15, 2006 10:50:44 AM -- Platform SDK
|
|
|
|
|
Sorry, but if I have to download something I'm not sure other developers in my company have installed, it's useless. I can't bring up a solution that can only be compiled on my computer.
Thanks anyway, I'll try if I can make sense of the Multimedia Timers cje mentioned
Martin
|
|
|
|
|
m.dietz wrote: I'm new to programming under Windows
The Windows Platform SDK is a standard part of the operating system and any development environment. You should not be developing without it. You might want to do some reading about things life safe strings etc.
led mike
|
|
|
|
|
could you use using multi-media timers? There are articles here on code project that talk about them. I use a class that wraps the multimedia timer that I inherit from (MMTimer) that allows me to get an Update callback when the timer fires.
cje
|
|
|
|
|
Hello!
I've implemented a singleton class and i discovered that in every .dll that i accessed a instance of the singleton a new instance is created. So, in every dll i have a different instance. My question is :How can I have a single instance of the singleton between multiple dll ?
This is my implementation:
class cSingleton
{
private:
static cSingleton* m_instance;
cSingleton(){};
~cSingleton(){};
public:
static cSingleton& Instance();
};
cSingleton& cSingleton::Instance()
{
if(m_instance == NULL)
{
m_instance = new cSingleton;
}
return *m_instance;
};
Thanks!
-- modified at 3:33 Thursday 17th August, 2006
|
|
|
|
|
Hi people
How can I get the IP of a machine in my workgroup?
I get a list of connected PCs in the workgroup using NetServerEnum, so I have the computer Name
Thanks in advance
|
|
|
|
|
Kharfax wrote: How can I get the IP of a machine in my workgroup?
Use gethostbyname() .
"Money talks. When my money starts to talk, I get a bill to shut it up." - Frank
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
Fantastic, thanks a lot David, that was a quick answer
|
|
|
|
|
void GetLocalIPAddress(char *ipAddress)
{
#define MAX_NAME_LEN 65
WSADATA wsaData;
if ( WSAStartup( MAKEWORD( 2, 2 ), &wsaData ) == 0 )
{
char HostName[MAX_NAME_LEN];
struct in_addr *ptr;
gethostname (HostName,MAX_NAME_LEN);
hostent *host = gethostbyname(HostName);
if(host == NULL)
{
ipAddress = NULL ;
WSACleanup( );
return ;
}
ptr = (struct in_addr *)host->h_addr_list[0];
CString str;
str.Format("%d.%d.%d.%d",
ptr->S_un.S_un_b.s_b1,
ptr->S_un.S_un_b.s_b2,
ptr->S_un.S_un_b.s_b3,
ptr->S_un.S_un_b.s_b4);
strcpy(ipAddress,(char*)str.GetString());
}
WSACleanup( );
}
|
|
|
|
|
Hey thanks a lot for the code
Anyway once David told me about gethostbyname the rest was easy.
But what I noticed is that I forgot to call WSACleanup(), now thanks to you I know I should call it
|
|
|
|
|
I have a CListCtrl embedded in a CView object which covers
the client area completely.
I am running the list control in report mode with several columns.
I want one column to follow the size of the listcontrol (view),
but I am running into some problems.
I cannot ask the list view for its client rect in the
OnInitialUpdate function because that always returns an
rectangle that is not correct yet. I don't know at what stage the client rect
will become valid so it is difficult to determine where
to put my column sizing code.
Any tips on how/when I can get the width of the window to
size my column?
Thanks
|
|
|
|
|
You can use the SetColumnWidth() member function, in addition to the LVSCW_AUTOSIZE / LVSCW_AUTOSIZE_USEHEADER parameter to resize your columns.
I tend to override the WM_SIZE message (OnSize() handler function), then call this function.
Now if you want to over the entire client area, you are on the right track when you said that you obtained the client rect. But not in the OnInitialUpdate() function, do this either after populating your control, or in the size handler.
I Dream of Absolute Zero
|
|
|
|