|
|
Hello Chris and thanks for the article
My month article: Game programming by DirectX by Lan Mader.
Please visit in: www.geocities.com/hadi_rezaie/index.html
Hadi Rezaie
|
|
|
|
|
I have two charachter string.I want to check if first one exist in second one.With which C library functiom or win32 API I can do it?
Mazy
"If I go crazy then will you still
Call me Superman
If I’m alive and well, will you be
There holding my hand
I’ll keep you by my side with
My superhuman might
Kryptonite"Kryptonite-3 Doors Down
|
|
|
|
|
|
Thnaks.
Mazy
"If I go crazy then will you still
Call me Superman
If I’m alive and well, will you be
There holding my hand
I’ll keep you by my side with
My superhuman might
Kryptonite"Kryptonite-3 Doors Down
|
|
|
|
|
Hi, I have created an MDI using CFormView. I have 2 forms. CMyProjView is the 1st form containing user inputs. The second form is activated using a button handler.
How to access data stored in CMyProjDoc from the second form?
I tried this in OnInitialUpdate() of CForm2
CMyProjDoc * pDoc = (CMyProjDoc*) GetDocument();
m_Variable = pDoc->data[i];
m_EditBox.Format("%.2f",m_Variable);
but I get an Assertion failure.
Any suggestions?
Thanks
|
|
|
|
|
Where exactly you're getting assertion failure?
Tomasz Sowinski -- http://www.shooltz.com
Free your mind and your ass will follow.
|
|
|
|
|
The form is created in CMyProjApp::InitInstance and a call to OnInitialUpdate() is made.
The failure occurs when I execute the project; i.e. immediately
|
|
|
|
|
Look at the call stack and check where exactly are you getting the assert.
Tomasz Sowinski -- http://www.shooltz.com
Free your mind and your ass will follow.
|
|
|
|
|
As Title.
It's said that "The system associates a window station with a process when the process is created" in MSDN.
but in what case does a process not associate a window station?
hi
|
|
|
|
|
From MSDN:
"A window station is a secure object that contains a clipboard, a set of global atoms and a group of desktop objects. The interactive window station assigned to the logon session of the interactive user also contains the keyboard, mouse, and display device. The interactive window station is visible to the user and can receive input from the user. All other window stations are noninteractive, which means that they cannot be made visible to the user, and cannot receive user input"
Johndotcom wrote:
but in what case does a process not associate a window station?
AFAIR, service processes under NT 3.5 had no winstation, but they've changed in NT 4.0. Why are you asking?
Tomasz Sowinski -- http://www.shooltz.com
Free your mind and your ass will follow.
|
|
|
|
|
A window station in the MS terminology is a virtual window station in which processes are run in a separate address space, and by the way are not visible to your current session (even in the task manager).
In fact MS introduced window stations along with desktops. The system can have many window stations. Each window stations can have many desktops.
The interactive window station, yours , is window station named "winsta0" with default desktop named "default".
Wat are window stations for ? for instance to circumvant current NT limits such like the total amount of GDI objects per session.
If you need to know more about this, do a search with "winsta0",
And I swallow a small raisin.
|
|
|
|
|
StephaneRodriguez wrote:
virtual window station in which processes are run in a separate address space
Processes are executed in separate address spaces, with winstations or not.
Tomasz Sowinski -- http://www.shooltz.com
Free your mind and your ass will follow.
|
|
|
|
|
You're right, but this precision is unnecessary,
And I swallow a small raisin.
|
|
|
|
|
I want to use file mapping and this is my code:
<br />
HANDLE hSearchedFile,hMap;<br />
LPVOID pFile,charSearch;<br />
LPCTSTR fName = strName.GetBuffer();<br />
<br />
hSearchedFile = CreateFile(fName,GENERIC_READ,0,<br />
NULL,OPEN_EXISTING,FILE_ATTRIBUTE_NORMAL,NULL);<br />
<br />
hMap = CreateFileMapping(hSearchedFile,NULL,PAGE_READONLY,0,0,NULL);<br />
<br />
if(hMap==NULL)<br />
AfxMessageBox("Could not create file-mapping object");<br />
<br />
pFile = MapViewOfFile(hMap,FILE_MAP_READ,20,0,0);<br />
<br />
<br />
if(pFile==NULL)<br />
AfxMessageBox("Could not map view of file.");<br />
hSearchedFile is always 0xffffffff but hMap and pFile are always NULL.I don't know whats the problem with my code.Any idea?
Mazy
"If I go crazy then will you still
Call me Superman
If I’m alive and well, will you be
There holding my hand
I’ll keep you by my side with
My superhuman might
Kryptonite"Kryptonite-3 Doors Down
|
|
|
|
|
CreateFile returns INVALID_HANDLE_VALUE. Probably file doesn't exist. Check GetLastError for more info.
Tomasz Sowinski -- http://www.shooltz.com
Free your mind and your ass will follow.
|
|
|
|
|
Right.I had problem in my file path.Thank you.
Mazy
"If I go crazy then will you still
Call me Superman
If I’m alive and well, will you be
There holding my hand
I’ll keep you by my side with
My superhuman might
Kryptonite"Kryptonite-3 Doors Down
|
|
|
|
|
Hello
I have a txt file I need to insert a string into at the start of. If the file does not exist I need to create it, and insert the line of txt.
What is the most elegant way of doing this using C++? An ugly ways seems to be to check if the file exists. If it doesn't, create, write and go home. If it does then I must make a copy of it, overwrite the original with my new line of txt, and then append the contents of my copy into this. This seems a real hack, and I am looking for a nicer way? Perhaps there is some nice strstream method?
Looking forward to replies...
solosnake
|
|
|
|
|
I can think of another hack - You can map it to memory, memmove the content, then write the text on the beginning.
The benefit will be, that the rewriting will be done by the OS.
Sonork 100.15206;PavelK
|
|
|
|
|
How do you change the length of memory-mapped file?
Tomasz Sowinski -- http://www.shooltz.com
Free your mind and your ass will follow.
|
|
|
|
|
I think You can't change the length of the memory mapped file, after it's mapped, but You can specify the new (bigger) length while creating the file mapping object using CreateFileMapping in dwMaximumSizeHigh and dwMaximumSizeLow parameters. You need to know the needed size in advance because the file will be truncated or filled with zeros otherwise.
Sonork 100.15206;PavelK
|
|
|
|
|
Thanks Pavel, but this cannot be done in pure C++ (can it?) and I prefer to write only using the stl. Can this be done using the stl?
- solosnake
|
|
|
|
|
Pavel Klocek wrote:
You can map it to memory, memmove the content
A memory-mapped file is fixed in length so you can't do what you proposed.
bibamus, edamus, cras moriemur [eat, drink, for tomorrow we die]
|
|
|
|
|
Is there any chance of loading file into memory? Or it may be multi-megabyte one?
Tomasz Sowinski -- http://www.shooltz.com
Free your mind and your ass will follow.
|
|
|
|
|
Its going to be a small file, but I am really looking for a C++ solution. File mapping is not part of the standard, as far as I know?
Thanks
- solosnake
|
|
|
|