|
I don't know, it is strange!
A good thing could be add the flag OFN_FILEMUSTEXIST here:
CFileDialog dlg(TRUE,"bmp",NULL,OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT,"Only BMP (*.bmp)|*.bmp|");
So you are sure that the file exist.
And I don't like very much
...,"Only BMP (*.bmp)|*.bmp|"
I prefere
...,"Only BMP (*.bmp)|*.bmp||"
Let me know
Have a nice code day
|
|
|
|
|
I will have to get the exact error if u have tested the code
so u might be right ,
can be some error in my code .
Vikas Amin
Embin Technology
Bombay
vikas.amin@embin.com
|
|
|
|
|
_Russell_ wrote: dlg.m_ofn.lpstrFile=str;
If lpstrFile is assigned a non-NULL value, so must nMaxFile also be used to indicate the size of the buffer pointed to by lpstrFile .
Why do it this way, however, when the constructor already has provisions for such?
"Take only what you need and leave the land as you found it." - Native American Proverb
|
|
|
|
|
vikas amin wrote: How to open a default fil by using the CFileDialog class
That is what the third parameter of CFileDialog 's constructor is for.
vikas amin wrote: I need to open a file named "1.bmp" located as "c:\1.bmp"
Then why bother with CFileDialog if you already know the name of the file?
Also, the filter should end with two ‘|’ characters.
"Take only what you need and leave the land as you found it." - Native American Proverb
|
|
|
|
|
yep if he knows filename & location then why he is using CFileDialog .
well i guess he wants to show his skills here.;)
|
|
|
|
|
vikas amin wrote:
I need to open a file named "1.bmp" located as "c:\1.bmp"
Then why bother with CFileDialog if you already know the name of the file?
Yeh good qestion , i need this only for Testing purpose &
when i cannot reach some thing in coding
it makes me crazy to get it done .
Vikas Amin
Embin Technology
Bombay
vikas.amin@embin.com
|
|
|
|
|
please tell me what's a callback function?
i've read it many times but i'm understanding it. whats the differnce between CallBack function and a normal function. please dont give a link. which i'm not going to understand. instead explain me.. with a little example. pleeeeeez
regards,
Rookie
Installing MFC...2% complete
|
|
|
|
|
A callback function is a normal function that the system calls when comes specified events.
An event could be a mouse click, or a tollbar botton click, ....
To link the event to the function it is used the MESSAGE_MAP
(usually in this macros are used the IDs of the objects that the user is using)
is it OK?
Have a nice code day
|
|
|
|
|
fisrt of all thanks for your patience,
for the first time i think i've understood whats a callback.
See here
LRESULT CALLBACK WndProc(HWND hwnd, UINT msg,WPARAM wParam, LPARAM lParam)
as i've read,WndProc processes all the messages send by the applications. right? so a message "coming" makes an event which inturn calls this CALLBACK wndProc right? am i right?
regards,
Rookie
Installing MFC...2% complete
|
|
|
|
|
Rokiee wrote: am i right?
Yes.
Have a nice code day
|
|
|
|
|
can i come with another dumb question?? later?
regards,
Rookie
Installing MFC...2% complete
|
|
|
|
|
Rokiee wrote: can i come with another dumb question??
Of course you can. This is the purpose of this message board
|
|
|
|
|
so nice of you
regards,
Rookie
Installing MFC...2% complete
|
|
|
|
|
Of course!!!
The problem could be only this:
Am I a good programmer, to solve your question? We will see.
Bye
Have a nice code day
|
|
|
|
|
Rokiee wrote: another dumb question??
The only dumb question is the one that's never asked. So ask away! We're here to help.
/ravi
My new year's resolution: 2048 x 1536
Home | Music | Articles | Freeware | Trips
ravib(at)ravib(dot)com
|
|
|
|
|
Following is a funciton where I am calling a thread
void CMyView::OnInitialUpdate()
{
...
AfxBeginThread(Thread_ScanConnectionState, m_sComPort, THREAD_PRIORITY_NORMAL, NULL, NULL, NULL);
...
}
//Foll is the thread definition
UINT CMyView::Thread_ScanConnectionState(LPVOID pParam)
{
CString sComPort;
sComPort = static_cast<lpcstr> (pParam);
return 1;
}
The declaration of the thread in the class header of CMyView is as below.
UINT Thread_ScanConnectionState( LPVOID pParam );
I get the compilation error as given below
error C2665: 'AfxBeginThread' : none of the 2 overloads can convert parameter 1 from type 'UINT (LPVOID)'
c:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\atlmfc\include\afxwin.h(4105): could be 'CWinThread *AfxBeginThread(AFX_THREADPROC,LPVOID,int,UINT,DWORD,LPSECURITY_ATTRIBUTES)'
c:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\atlmfc\include\afxwin.h(4108): or 'CWinThread *AfxBeginThread(CRuntimeClass *,int,UINT,DWORD,LPSECURITY_ATTRIBUTES)'
while trying to match the argument list '(overloaded-function, CString)'
Please let me know the error.
laiju
|
|
|
|
|
Hi,
First: AfxBeginThread takes a static function pointer. Yours is not a static function. IOW, make Thread_ScanConnectionState static.
Second: In the func nody you typed 'static_cast(pParam)': incorrect.
The correct is:
sComPort = static_cast<cstring> (pParam);
Third: Do not do extra typing: AfxBeginThread's default parameters work fine.
You need not pass THREAD_PRIORITY_NORMAL or the NULLs.
--
======
Arman
|
|
|
|
|
Second: In the func nody you typed 'static_cast(pParam)': incorrect.
The correct is:
sComPort = static_cast (pParam);
Sorry, it seems the editor doesn't love static_cast's signature
--
======
Arman
|
|
|
|
|
Arman Z. Sahakyan wrote: Sorry, it seems the editor doesn't love static_cast's signature
the editor is just html, so don't use html tags...
<> are interpreted.
if you don't want it to, check the Ignore HTML tags in this message (good for code snippets) checkbox or use < > codes instead...
TOXCCT >>> GEII power [toxcct][VisualCalc 2.20][VisualCalc 3.0]
|
|
|
|
|
|
Thanx for the info. But i didnt know that the THREAD func needs to be static.Thanx anyway
laiju
|
|
|
|
|
Note that thread function must be either global or a static class-method.
I wanted to say it cannot be a non-static class-method as you were using.
--
======
Arman
|
|
|
|
|
when a function is a class member (except static ones), it receives an implicit parameter which is the this pointer. this implicit parameter changes the signature of what you see of your function in design mode...
for instance :
class A {
public:
void foo(int);
};
just considering the case of this function, its signature is in fact :
void A::foo(A*, int);
so, as AfxBeginThread() receives a function pointer, this parameter must implement a particuliar function signature, it must be exactly as you defined it. this is why your function must be global, or at least static (because static members don't know specific instances of a class - they are also known as class function)...
hope that helps...
TOXCCT >>> GEII power [toxcct][VisualCalc 2.20][VisualCalc 3.0]
|
|
|
|
|
Please suggest beginner level tutorial(s) for ActiveX programming in VC++
thanks
david
|
|
|
|
|
Hi guys,
I've been out for a while and now I have to adapt a program for an interview to test my skills. It's all bmp's, so opening, rotating, changing colors etc...
I've been searching a bit, but of course MSDN isn't helping and I couldn't really find something on CP either.
Can anybody point out a good tutorial or something?
I do know how bmp's are built (a header and then the colors row by row)
I'm really confused with CBitmap and HBITMAP (and if I'm not mistaken you've got a Bitmap and BITMAP too?)
tnx!
(PS: my interview is on monday so I've got a lot of studying to do)
No hurries, no worries.
|
|
|
|