|
I think its good because you dont know where's text that you want to replcase
|
|
|
|
|
You can use variuos seek functions (fseek, ofstream::seekp, ..., depending on API) to set the write pointer position in a file, and then start replacing data inplace. You cannot insert extra bytes however, but you can overwrite existing data.
|
|
|
|
|
Hello,
not need to insert extra bytes, to overwrite existing data is ok, now need to know what when the new data ar larger then the old!?
So i think i use the previous way, i dont need this in an multithread function, i read only one file
one times nad change a part of them, replace the old part with new content!
regards
break;
-- modified at 8:48 Tuesday 31st October, 2006
|
|
|
|
|
I have problem using the function ResUtilStartResourceService(...)
i included the file clusapi.h and the compiler gives me the error "undeclared identifier".
i tried to include the file Resapi.h the compiler gives me the error "unresolved external symbol _ResUtilStartResourceService@8".
Best regards,
Simos
|
|
|
|
|
I figured out the error.
The problem now that the service is installed, but when i call the function ResUtilStartResourceService(...) it returns error code 1060 (service does not exist).
Can any body help with this.
Best regards,
Simos
|
|
|
|
|
Check the name of the service you are passing to the function, is is the correct one ?
Darka [ Xanya]
"I am not a slave to a god that doesn't exist."
|
|
|
|
|
Yes it is correct.
Regards,
Simos
|
|
|
|
|
Yes it is correct yet it returns the error 1060, any ideas?
Regards,
Simos
|
|
|
|
|
Silly question....
Have you actually installed your service, if so how did you do this ?
It does sound like this hasn't been done, you must install the service correctly first.
Darka [ Xanya]
"I am not a slave to a god that doesn't exist."
|
|
|
|
|
ResUtilStartResourceService() is defined in "Resapi.h"
You are including the wrong header file, as you can see from the ResUtilStartResourceService() help page in the MSDN (if you'd looked )
Darka [ Xanya]
"I am not a slave to a god that doesn't exist."
|
|
|
|
|
Hello!
I have a simple question. Let us assume that all my resources are located in the resource-only DLLs. I load DLL, use resources from it, then unload it, load another DLL and use resources from that another DLL. What is bothering me that is: what happened to the memory, allocated to the resources from the first DLL.
For example:
<br />
HMODULE language_DLL_handle = LoadLibraryEx(language_DLL_file_name, NULL, LOAD_LIBRARY_AS_DATAFILE);<br />
HRSRC hrsrcDlg = FindResource(language_DLL_handle, TEXT("MyDialog"), RT_DIALOG);<br />
HGLOBAL hglobalDlg = LoadResource(language_DLL_handle, hrsrcDlg);<br />
LPDLGTEMPLATE pDlgTemplate = (LPDLGTEMPLATE)LockResource(hglobalDlg);<br />
<br />
DialogBoxIndirect(hInst, pDlgTemplate, NULL, (DLGPROC)DlgFunc);<br />
<br />
FreeLibrary(language_DLL_handle);<br />
language_DLL_handle = LoadLibraryEx(another_language_DLL_file_name, NULL, LOAD_LIBRARY_AS_DATAFILE);<br />
<br />
hrsrcDlg = FindResource(language_DLL_handle, TEXT("MyDialog"), RT_DIALOG);<br />
hglobalDlg = LoadResource(language_DLL_handle, hrsrcDlg);<br />
pDlgTemplate = (LPDLGTEMPLATE)LockResource(hglobalDlg);<br />
Here is the question: what happens to the memory, used by the first dialog template, loaded from the first DLL? Is it leaked? Does that mean that if, for example, I have changed DLLs 1000 times my app will allocate the huge amount of memory which is never freed?
Or that memory is somehow magically freed on the call to FreeLibrary?
PS: There are specialized functions LoadMenu - DestroyMenu, LoadCursor - DestroyCursor and so on. But in my case of the Dialog Template resource there is no such function. So, I am wondering ...
PPS: There is function FreeResource. But it is obsolete and is essentially a nop under Win32.
|
|
|
|
|
|
No. This function (FreeResource) does nothing under Win32. Look at it in debugger:
FreeResource:<br />
77E6D5A2 xor eax,eax <br />
77E6D5A4 ret 4<br />
The answer to my question lies here: Microsoft KB 193678[^]
In particular:
The resource obtained with LoadResource is automatically freed when the module that it was loaded from is unloaded. If the resource is in a .dll, freeing the .dll using FreeLibrary also frees the resource.
It means that under Win32 LoadResource does not allocate any additional memory, so, essentially, FreeLibrary frees resources memory too. So, I don't need do any additional steps to free the memory - all the memory is gone from my address space when DLL is unloaded by FreeLibrary.
|
|
|
|
|
Hi everyone,
in my MDI Project i don't use the Doc/View Architecture.
So i re-use always the ChildWnd & Doc for each View...
I read on the MSDN Site that a Doc/View Architecture is not obligatory.
So i could create a simple CMDIChildWnd and display it ( so i don't need to add Templates )
But in the ON_CREATE i must add all components by programmating.
Is there a solution to associate a Dialog with the ChildWnd ( add controls on the dialog is easiser )
Or is it not possible and i must continue, by creating the Templates with ChildWnd, View and Doc ?
Many Thanks
|
|
|
|
|
One way is to use a modeless dialog as the client window of the MDIChild frame.
In the following example I show handler functions for WM_CREATE and WM_SIZE.
pMyDialogClient is a CMyDialogClient pointer - add this member to your CMyMDIChildWnd class.
int CMyMDIChildWnd::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
if (CMDIChildWnd::OnCreate(lpCreateStruct) == -1)
return -1;
pMyDialogClient = new CMyDialogClient();
pMyDialogClient->Create(IDD_MYDIALOG, this);
return 0;
}
void CMyMDIChildWnd::OnSize(UINT nType, int cx, int cy)
{
CMDIChildWnd::OnSize(nType, cx, cy);
if (pMyDialogClient && IsWindow(*pMyDialogClient))
pMyDialogClient->MoveWindow(0, 0, cx, cy);
}
|
|
|
|
|
Ok i see, it isn't a Frame within a Dialog, but 2 objects, ( the frame and a Dialog )
which are superposed and moves the same way, that the user sees all the time "one" window
Good idea ! Thanks
|
|
|
|
|
baerten wrote: Ok i see, it isn't a Frame within a Dialog, but 2 objects, ( the frame and a Dialog )
which are superposed and moves the same way, that the user sees all the time "one" window
Yes
In MFC they call them frame windows and client windows ("views") because they are in the client
area of the frame. There is code built in to the CFrameWnd class to automagically move/size the
"client window" for you so you could avoid having to do the MoveWindow() yourself, but for dialogs
it takes a little tweaking in the dialog class if I remember right.
Cheers,
Mark
|
|
|
|
|
Ok, it seems to work, big thanks
But there is still a problem, if i click on the Wordkspace, the modeless-Dialog disappears and
the Frame rests open.
Because Dialogs are another windows, which are displayed as a new element on the Windows TaskBar.
is it possible to change it?
If not i must use the Doc/View Architecture.
But there, i don't know a possibility to open a Frame ( with View ) with parameters
For example to set an initial height&width, because i open the frames with the Template :
CString Cur;
CDocTemplate *Selected;
POSITION pos = theApp.GetFirstDocTemplatePosition();
while(pos != NULL) {
Selected = (CDocTemplate*)theApp.GetNextDocTemplate(pos);
ASSERT(Selected != NULL);
ASSERT(Selected->IsKindOf(RUNTIME_CLASS(CDocTemplate)));
Selected->GetDocString(Cur,CDocTemplate::docName);
if(Name == Cur) {
Selected->OpenDocumentFile(NULL);
}
}
Or is my procedure completly wrong and i can open the View in the Frame like your example with the Frame and the dialog
So that i create myself a Frame and in the Create-Handler i associate myself the view to this frame
so that i don't need the templates ( Because if i have 50 windows i need to add 50 templates at the beginning of the application )
|
|
|
|
|
baerten wrote: if i click on the Wordkspace, the modeless-Dialog disappears and
the Frame rests open.
Because Dialogs are another windows, which are displayed as a new element on the Windows TaskBar.
is it possible to change it?
The only style flags you need are (WS_CHILD | WS_VISIBLE) for the imbedded modeless dialog.
That means on the dialog's property sheet (edit the dialog, hit F4 key) the "Style" setting
should be Child (not Popup or Overlapped) and the "Visible" setting should be set to true.
All other settings can probably be false. That should fix the "new element on the Windows
TaskBar" problem.
By the way, check out CFormView class for using controls based on a dialog template in a view.
To get access to the frame window at create time, check out the MFC source code for
CMultiDocTemplate::OpenDocumentFile(). You can do the same steps and have access to the frame
window pointer at create time.
|
|
|
|
|
By the way, check out CFormView class for using controls based on a dialog template in a view.
Yes, i made it already, but there i used the Templates.
In future i will change the view of the Frame a runtime, passe parametes to it etc
So i think that the utilisation of the templates isn't so usefull.
If i can create a CFrameWnd myself, i could also associate a CFormView by "own" programmation
then it's faster and not so complicated to pass parameters to my View
I will study the MFC Functions for understand how to open and associate a CFormView to a FrameWnd without Templates
If you have an example, it would be nice if you can show an piece of your code
Anyhow big thanks for spending time on my
(Because to jump into MFC without lessons or good books it's quite difficult ... )
-- modified at 5:13 Friday 3rd November, 2006
So far so good i open the CFormView in my Frame
Now i only need to change the View at Runtime and all is wonderfull
|
|
|
|
|
Hi together,
I'm trying to write a programm in order to track people walking past a webcam. What I actually need is their position infront of the camera.
I have tried several things until now. Using different software. MAX/MSP, Java, and OpenCV/C++ which seems to be the best thing. I'm also working on EyesWeb which also uses OpenCV. I need to transfer the data I get to Flash. EyesWeb does that via OSC.
I'm still not sure if C++ is the best language to use.
No I read about motion detection in C# so again im quite confused where to start or to continue.
http://www.codeproject.com/cs/media/Motion_Detection.asp
So my first question is: Is there a possibility to transfer data to flash (maybe via xml, osc. )?
In EyesWeb I tried to use Background Subtraction in order to get silhouettes of the people walking by. The problem is that the webcam has too much noise and the programm analyzes motion in parts where there is none.
Afterwards I wanted to use blob extraction to get the position of the people. The second problem was that sometimes a color has the same gray value as the background and then there's no differnce in that part
Then I heard about block matching which might be better, but I'm not sure. Is this the right algorithms for my project?
Does anyone have experience with this kind of tracking?
Hope you can help or have some hints
|
|
|
|
|
Why not just take an image on a timer loop and compare it to previous images? Comparing an image should be simple enough in your situation. Just select a few random pixels in the image and compare the colours. You could even go as far as applying an algorithm to compensate for light changes through the day.
|
|
|
|
|
thanks for your suggestion,
that's how I was going to do the analysis. I'm just concerned about the performannce and think C++ has the best performace since your able to use directX / direct show. I need a high frame rate.
Besides there are OpenCV libraries which take care of image processing.
Still I'm wondering if there's a better way or say a better language to use.
|
|
|
|
|
Performance doesn't really come into play when talking about motion dection. Infact, no drawing to the screen is required for it. All you do is capture an image every second or so and compare it to the last or if you want to do it properly the previous 10 or so. Comparing a handful of RGB values will take a split second. It's only after you detect motion that you launch into directX or whatever your using.
|
|
|
|
|
One more problem, Please show me how to get the position of a mouse and extract this data to a grid. In this case what type of Grid I should use?
|
|
|
|
|