|
The pre-defined variable m_hWnd already holds the handle to the window of the dialog, so that is the one to use in your calls to SetDlgItemText() .
jawadali477 wrote: i'm not good in programming with handles. This is something you need to study as it is fairly key to the whole Windows framework.
|
|
|
|
|
thank you Richard MacCutchan for your replies.
i did use m_hWnd in SetDlgItemText() in first place, but at that time it gave the error as m_hWnd :undeclared identifier . you see i'm using a thread to call mouse function. do i need to redefine m_hWnd ?? if yes, where??
|
|
|
|
|
If your mouse handler is not part of the dialog class then you need to store m_hWnd into a global variable in your OnInitDialog() method. I wonder, however, why you think it necessary to run this in a separate thread and why you are using opencv, when you could accomplish your goal with a much simpler MFC based application.
|
|
|
|
|
thank you Richard MacCatchan for replies.
i have implemented MFC based application using picture control. i have included bitmap image in picture control and have defined subclass where i have used OnLButtonDblClk to get the co-ordinates of picture control (not image u know) in static box. and it works fine. but i have some questions and need help.
1. how to implement zoom in/out an the scroll option (for large image sizes)?
2. when applying zoom in/out, will the pixel co-ordinates change (i mean if a point is lying on say (x,y) in picture control before zoom in what will happen to its co-ordinates after zoom in)?
Regards
JAwad
|
|
|
|
|
1. Google should be your first place to look for some suggestions[^].
2. As far as I know, the position will remain constant, it is just the scale that changes, but again you may wish to try some research to see if there are any suggestions around.
|
|
|
|
|
I am developing a application in MDI which contains few child windows.
And also i want few windows which is not attached to CMainframe.So i created new class derived from CFrameWnd.
pTagSummaryTemplate = new CSingleDocTemplate(
IDR_MAINFRAME,
RUNTIME_CLASS(CHarmonyDoc),
RUNTIME_CLASS(CFrameWnd), RUNTIME_CLASS(CTagSummary));
AddDocTemplate(pTagSummaryTemplate);
And also each window has to updated frequently and im doing this by uisng below code for MDI childwindows from CMainframe
CMDIChildWnd *fChWnd = GetActivePanelWnd();
if(fChWnd->GetSafeHwnd())
{
CView *curView = ((CView *)fChWnd->GetActiveView());
if(curView)
{
((COverView *)curView)->UpdatePanel();
}
}
But for SDI, i dont know how to get activeview(Current active view of SDI)So pls help me.
|
|
|
|
|
Since SDI stands for Single Document Interface there is only one document and one view, so it is always the active one.
|
|
|
|
|
Actually, in an SDI, there is only one document, but there can be many views.
In any event (to the OP) the proper way to update views in SDI or MDI is to store and update your data in the document, then call the document's UpdateAllViews method, passing a hint if needed.
This automatically calls the OnUpdate method of every view without you having to call it manually. In that method, you can do whatever is necessary to update the view.
Hope this helps.
Karl - WK5M
PP-ASEL-IA (N43CS)
PGP Key: 0xDB02E193
PGP Key Fingerprint: 8F06 5A2E 2735 892B 821C 871A 0411 94EA DB02 E193
|
|
|
|
|
Fine, but you should be replying to the OP's message, not to mine.
|
|
|
|
|
Hi,
I have a CAsynSocket derived class as a member of my CWinThread derived the problem
is my CAsynSocket derived constructer takes a port #
How can I call/create my CAsyncSocket derived class implicitly passing the constructer a port no
for example my derived CWinthread class
Class MyCWinthread : public CWinThread
{
Myasnycsocket thissocket;
.
.
.
.
}
// myderived CAsynSocket Class
class Myasncsocket : public CAsyncSocket
{
private:
int port;
};
// constructer
Myasnycsocket::Myasynsocket(int myport)
{
port = myport;
};
thanks
|
|
|
|
|
Just write a default constructor that calls the other constructor with a default port number. Something like:
Myasnycsocket::Myasynsocket()
{
Myasynsocket(33);
};
Note: please use proper <pre> tags around your code, and indentation within it, so it is more readable as in this case.
|
|
|
|
|
Hi,
I have used pre tags in the past they don't seem to take
I'll try again
What I would really wanted to do was to call Myascncsocket constroctor directly so I can initlize it withe port I want
E.g.
<pre lang='cpp'>
class MyCWinThread : public CWinThread
{
myasncsocket thisasyncsocket;
.
.
.
};
MyCWinthread::MyCwinthread(int myprort)
{
mayasyncsockt(port);
}
myasncsock::myasncsocket(int myprot)
{
port = myport;
}
</pre>
I am assuming this will initlize myasyncsocket with the port I want
Thanks
|
|
|
|
|
As you can see (when you are editing and even after you have posted) your <pre> tags are not working, you may need to check your settings under the "Forums" tag.
As to your question, it's still not clear what you are trying to do. The above code does not really make sense.
|
|
|
|
|
I don't know where the settings tab is however I unchecked the box "treat my content as plain text not HTML" maybe that will do the trick
My question is the following
if I have a derived the CWinThread with a derived CAsynSocket class as a member of that CWinThread derived class
However my Derived CAsyncSocket Class contructer takes a int "port" number
is there anyway to call the derived CasynSocket constructer directly passing it a port number calling class member class members contructors directly I can control thier
creation
class MyCwinThread : public CwinThread
{
Myasycsocket thisasynsocket;
.
.
.
.
}
class Myasncsocket : public CAsyncSocket
{
private:
int port
}
MyCwinThread::MyCWinThread(int myport)
{
thisasyncsocket(myport);
}
MyascncSocket::Myasncsocket(int myport)
{
port = myport;
}
|
|
|
|
|
I think you'd just declare another constructor for your myAsyncSocket class?
Since the class already has a Create[^] method, I guess you'd save the number for your own reference then create the socket using the specified port.
class myAsynchSocket : public CAsyncSocket
{
public:
myAsynchSocket(int portNum);
private:
int myPort;
};
myAsynchSocket::myAsynchSocket(int portNum)
{
myPort = portNum;
Create(myPort);
}
|
|
|
|
|
Well, simple way is to allocate it on the heap dynamically...
Class MyCWinthread : public CWinThread
{
Myasnycsocket *thissocket;
}
BOOL MyCWinthread::InitInstance()
{
CWinThread::InitInstance();
thissocket = new Myasnycsocket( 33 );
}
Just don't forget to deallocate the dynamic memory afterward.
|
|
|
|
|
Yes I know
I was wonering what the syntax would be to allocate it on the stack
Thanks
|
|
|
|
|
The default constructor is always going to be called in that case, as other have stated, you can give it a default value and that works as well. Alternatively, you can use multiple inheritance in this case, so that the CWinThread derived class is ALSO derived from the socket class and therefore requires the caller to pass the socket number.
|
|
|
|
|
In that case I cann't use AfxBeginthread to Create the derived CWinthread as the CwinThread constructer return by the Helper AfxBeginthread doesn't take any paramters
MyCWinThread :: MyCwinthread(int port) : Myasncsocket(port)
I would then also have to Call MyCwinthread::Createthread as I beleive the Framework Helper function does both correct
|
|
|
|
|
AfxBeginThread is just a helper, there's no need to use that if it doesn't fit your needs, but it seems like you got the gist of things.
|
|
|
|
|
here is data (in ASCII format) downloaded from server by command "LIST":
total 1100
-rw------- 1 root 38 Dec 16 2010 .bash_history
(omitting several lines here)
drwx--x--x 6 other 512 Oct 13 2005 usr
My question is:
How do I know the downloading is completed?
I guess I need to send count of bytes downloaded to server, so server will tell if downloading is OK.
If so,
What instruction (command) should I send to server?
Which port (command port or data port) should I use for sending the instruction?
Thanks.
.
|
|
|
|
|
Is this something to do with C++ or are you just trying to understand how to use FTP? If you are doing this programmatically then you just keep reading the socket until no more data is presented.
includeh10 wrote: Which port (command port or data port) should I use
Not sure that I understand your question here; what do you mean by "command port or data port"?
|
|
|
|
|
See RFC 959[^], section 4.2 (FTP Replies).
Just check for three digits followed by a space at the begin of each line. With the LIST command, it is usually the code 250 followed by server dependant text, e.g.:
125 List started OK.
[list output]
250 List completed successfully.
|
|
|
|
|
I got a exception on CAsynSocket::create
not sure why ??? memory exception, sock err
so as per my earlier thread I generated this huge catch(s) block
my question is the following if its a socket error
will the catch for derived CInternetException catch the error
my socket has 2 machines communicating not necessarly the Internet
void allexceptions::mycatch()
{
CRuntimeClass* runtimeptr;
runtimeptr = GetRuntimeClass();
try{}
catch(CMyexception e)
{
if (strcmp(runtimeptr->m_lpszClassName,"CWinThread") == 0)
ReportError(MB_OK,IDR_EXCEPTION_THREAD);
}
catch(CMysimpleexception e)
{
if (strcmp(runtimeptr->m_lpszClassName,"CWinThread") == 0)
ReportError(MB_OK,IDR_SIMPLE_EXCEPTION_THREAD);
}
catch(CMyinvalidargexception e)
{
if (strcmp(runtimeptr->m_lpszClassName,"CWinThread") == 0)
ReportError(MB_OK,IDR_INVALIDARG_THREAD);
}
catch(CMymemoryexception e)
{
if (strcmp(runtimeptr->m_lpszClassName,"CWinThread") == 0)
ReportError(MB_OK,IDR_MEMORY_THREAD);
}
catch(CMynotsupportedexception e)
{
if (strcmp(runtimeptr->m_lpszClassName,"CWinThread") == 0)
ReportError(MB_OK,IDR_NOTSUP_THREAD);
}
catch(CMyarchiveexception e)
{
if (strcmp(runtimeptr->m_lpszClassName,"CWinThread") == 0)
ReportError(MB_OK,IDR_ARCHIVE_THREAD);
}
catch(CMyfileexception e)
{
if (strcmp(runtimeptr->m_lpszClassName,"CWinThread") == 0)
ReportError(MB_OK,IDR_FILE_THREAD);
}
catch(CMyresourceexception e)
{
if (strcmp(runtimeptr->m_lpszClassName,"CWinThread") == 0)
ReportError(MB_OK,IDR_RESOURCE_THREAD);
}
catch(CMyoleexception e)
{
if (strcmp(runtimeptr->m_lpszClassName,"CWinThread") == 0)
ReportError(MB_OK,IDR_OLE_THREAD);
}
catch(CMydbexception e)
{
if (strcmp(runtimeptr->m_lpszClassName,"CWinThread") == 0)
ReportError(MB_OK,IDR_DB_THREAD);
}
catch(CMyoledispatchexception e)
{
if (strcmp(runtimeptr->m_lpszClassName,"CWinThread") == 0)
ReportError(MB_OK,IDR_OLEDISP_THREAD);
}
catch(CMyuserexception e)
{
if (strcmp(runtimeptr->m_lpszClassName,"CWinThread") == 0)
ReportError(MB_OK,IDR_USER_THREAD);
}
catch(CMydaoeexception e)
{
if (strcmp(runtimeptr->m_lpszClassName,"CWinThread") == 0)
ReportError(MB_OK,IDR_DA_THREAD);
}
catch(CMyinternetexception e)
{
if (strcmp(runtimeptr->m_lpszClassName,"CWinThread") == 0)
ReportError(MB_OK,IDR_INTER_THREAD);
}
}
|
|
|
|
|
Hello!
I am currently working on a mid-scale project and compiling and linking worked perfect until now. I played around with my resource files and the linker won't eat my object files anymore:
LINK : fatal error LNK1123: failure during conversion to COFF: file invalid or corrupt
I already deleted the resource file, the resource header and made them new about 5 times, I removed all possibly deprecated object and pch files and restartet Visual Studio countless times, but it still won't work.
Any ideas?
|
|
|
|