|
just tokenize it by using strtok, bear in mind however there are some issues on strtok. (check the MSDN)
Sonork 100.41263:Anthony_Yio
|
|
|
|
|
Why do you use .Ini file?
get the value into CString;
Find where are the ';', with CString.Find(";",0);
Get the string with CString.Mid
<italic>Work hard and a bit of luck is the key to success.
|
|
|
|
|
use the fgets() function to read each complete line into an array of char (or CString or whatever you use), then just trawl through it until you find a ';' character and set it to 0 or '\0'. Once you've done that add it the combo box and read in the next line...
"When I left you I was but the learner, now I am the master" - Darth Vader
|
|
|
|
|
Hello there,
I want to use a functionpointer to ReadFile and WriteFile in my program, but for some reason the code won^t compile correct. This is how I declare the function pointer:
BOOL (*pReadFile)(HANDLE , LPVOID , DWORD , LPDWORD , LPOVERLAPPED ); <br />
<br />
pReadFile = &ReadFile;
The compiler complains about:
error C2440: '=' : cannot convert from 'int (__stdcall *)(void *,void *,unsigned long,unsigned long *,struct _OVERLAPPED *)' to 'int (__cdecl *)(void *,void *,unsigned
so problem seems to be the __stdcall and __cdecl declarators.. Anyone knows how I should declare my function pointer in order for this to work???
Thanks for any advice,
Davy
|
|
|
|
|
ok , just placed the answer in my question myself it seems...`
I had allready tried to add the __stdcall in my pointer declaration, but put it after the *..
Answer to my question is:
declare pReadFile as:
BOOL (__stdcall*pReadFile)(HANDLE /*hFile*/, LPVOID /*lpBuffer*/, DWORD /*nNumberOfBytesToRead*/, LPDWORD /*lpNumberOfBytesRead*/, LPOVERLAPPED /*lpOverlapped*/);
But it would be nice if anyone might be able to tell me where that __cdecl and __stdcall come from...
Thx..
Davy
|
|
|
|
|
|
How to convert an .exe to .dll? I tried to add project>files to add .cpp and .h files. But when I compile it, I got an error "fatal error C1189: #error : include 'stdafx.h' before including this file for PCH"
Sorry if my question is too newbie, I cant find any solution in my VC++ reference book.
Thanks.
|
|
|
|
|
First you should make a project, which would make dlls, this option you would have to select, while making the project itself.
And when you write the .cpp files, the first #include should be #include stdafx.h, to avoid PCH (pre compiled headers) problems, then on you can include other header files.
And you would have to add some keywords with the functions you are exposing in the dll.
For this, refer to some dll examples.
- Shailesh
|
|
|
|
|
|
Hi
I have an view opened in my MDI application. And, after a execution of a specific process, the file which is viewed is modified. I want to refresh the view. How do i do that. Can someone please help me on this. I thank in advance.
Cheers
Mughi
|
|
|
|
|
UpdateAllviews(NULL);
<italic>Work hard and a bit of luck is the key to success.
|
|
|
|
|
I have tried this. But still, its not working. Where exactly should i implement this UpdateAllviews(NULL);
Sorry for the inconvenience.
thanx
mughi
|
|
|
|
|
Mughi wrote:
Where exactly should i implement this UpdateAllviews(NULL);
After finishing the process.
<italic>Work hard and a bit of luck is the key to success.
|
|
|
|
|
Thats true. But my code flow is like this.
All i have created is an MDI application of the following.
class CComputeApp : public CWinApp
class CComputeView : public CEditView
class CComputeDoc : public CDocument
1. I haven't coded anything on File open / save / close.
2. Everything is taken care automatically.
3. Imagine a file named compute.txt is opened in my application.
4. And after that, I run a process (thats a different class) from CComputeApp.
5. And the process returns a string (contains the filename).
6. Using the string, i call CDocument* CComputeApp::OpenDocumentFile(LPCTSTR lpszFileName) to open the file.
7. The problem is, if the file is already opened, this OpenDocumentFile method doesn't call CComputeDoc::OnOpenDocument(LPCTSTR lpszPathName).
8. And so, the view is not updated.
This is where my problem is. And thats why, i was curious about the place of code.
Sorry for all the frustrations. And hope that, i would overcome this problem.
Again, I thank in advance.
thanx
mughi
|
|
|
|
|
I hope i don`t get you wrong. I think I get the same problem with you before. I haven`t got the solution yet. I tried using CDocument::OnCloseDocument (if i`m not mistaken) and it close the application. I think we should code to call the File Close.
<italic>Work hard and a bit of luck is the key to success.
|
|
|
|
|
call Document's UpdateAllViews()
There is no spoon.
mail
|
|
|
|
|
Hi
U can call updateAllViews() which calls the update function which we have added.
I do hope this may help you.
Sujan
|
|
|
|
|
Thats true. But my code flow is like this.
All i have created is an MDI application of the following.
class CComputeApp : public CWinApp
class CComputeView : public CEditView
class CComputeDoc : public CDocument
1. I haven't coded anything on File open / save / close.
2. Everything is taken care automatically.
3. Imagine a file named compute.txt is opened in my application.
4. And after that, I run a process (thats a different class) from CComputeApp.
5. And the process returns a string (contains the filename).
6. Using the string, i call CDocument* CComputeApp::OpenDocumentFile(LPCTSTR lpszFileName) to open the file.
7. The problem is, if the file is already opened, this OpenDocumentFile method doesn't call CComputeDoc::OnOpenDocument(LPCTSTR lpszPathName).
8. And so, the view is not updated.
This is where my problem is. And thats why, i was curious about the place of code.
Sorry for all the frustrations. And hope that, i would overcome this problem.
Again, I thank in advance.
thanx
mughi
|
|
|
|
|
hi all,
I am doing MFC Project..There is a Dialog to LOG ON to the Program.If any one enter user name & password & click "SIGN IN" Button ,I want to display a Dialog Box with "WAIT" Text until the usename validate.
So How do I add wait dialog using Threads or some thing else?
please help me
thanks..
|
|
|
|
|
Hi
You @ VC++ components there is a component called "Splash screen". You can use this / U will get some idea on looking @ that class.
Hope this helps you
SUjan
|
|
|
|
|
hi,
thank u very much.But do u know that how do we do it using Threads?
|
|
|
|
|
Hi
Create a worker thead call the showing code and once the process is over kill the thread. Again sometimes kill the thread may be a problem. I think.
Sujan
|
|
|
|
|
Create a CDialog with text "waiting". DoModal() this dialog.
When the validation is over ::SendMessage(gh_WaitDlg,WM_CLOSE,NULL,NULL);
to close the waiting dialog.
For this your validation should be from a different thread and that thread should have a handle to the waiting dialog.
There is no spoon.
mail
|
|
|
|
|
Using POSIX pthreads, implement the finite buffer consumer/producer code on chapter 5 slide 51. The buffer size is 10, and stores integers. The producer producers the values from 1 to 100 and puts them in the buffer. The consumer removes them and prints them as they are removed.
The program should compile and run on Unix.
aravind
|
|
|
|
|
I can send you the source code for the program for chapter 5, slide 50. Will that do? My program was rated very highly by Consumer Reports, but I don't know about the producer part.
/ravi
My new year's resolution: 2048 x 1536
Home | Articles | Freeware | Music
ravib@ravib.com
|
|
|
|