|
Hy.
I want to make a audio/video server that caprures video from my web cam which can be opened with the "windows media player"(open url).
andrei
|
|
|
|
|
I am in hell with this. Imagine a dll and an app that want to use the same instance of a static class (for management purposes) so they can share its knowledge (such as common search paths used when loading files). To mean this sounds awesome, but do you think there was a clean way to do it that is well documented, not a chance. Well I can't find one anyway. Just to clarify, I have a class with static functions and static members that I access using MyClass::DoSomething(), I want *any* loaded dll to absorb this instance of the class and *not* construct another in its own virtual memory address space. What is the best way to go about doing it, is there an article that can save my ever-decreasing hair? Thanks all.
|
|
|
|
|
static anythings and DLL's are always going to be tricky.
You might want to rethink the design a bit and see if you can reorganise the code to use COM objects.
It may mean that you can just pass interface pointers between the application and the DLL's. It may make extensibility and maintenance far simpler, because the smarts for querying for interfaces, and for defending against crossing address spaces, are all inside the component.
If you can keep you head when all about you
Are losing theirs and blaming it on you;
If you can dream - and not make dreams your master;
If you can think - and not make thoughts you aim;
Yours is the Earth and everything that's in it.
Rudyard Kipling
|
|
|
|
|
Nice idea, I like the sound of that, I think I'll investigate the COM approach. Never done any COM before mind, any hints, tips, ideas or articles? Thanks for the suggestion mind, its always nice to hear a fresh idea when your staring at a brick wall
Thanks again,
Alan.
|
|
|
|
|
It takes a while to get your head around COM, but it really makes sense when it all starts to come together. COM really is one of the key foundations for everything in windows today - it explains why you need a registry, why you need install programs, how ActiveX controls really work - and lots of other things.
Microsoft are now pushing C# and VB.NET and Managed C++ which are all really neat ways to play with COM in a safe little sandbox. Except now they've made it even easier to write COM components - which are now called assemblies.
Mike Dunn's articles (as always ) are a good place to start
http://www.codeproject.com/com/comintro.asp[^]
http://www.codeproject.com/com/comintro2.asp[^]
If you can keep you head when all about you
Are losing theirs and blaming it on you;
If you can dream - and not make dreams your master;
If you can think - and not make thoughts you aim;
Yours is the Earth and everything that's in it.
Rudyard Kipling
|
|
|
|
|
By the time you were done writing your COM dll, you would end up with a perhaps overly fancy system of just Gets and Sets on some data items.
You could always put the data into a shared memory segment and then write accessor functions inside a DLL. Protect the memory with a Mutex, since I think you would need to do that anyway with the COM dll.
Your static C++ class could be functions that wrap the calls into the DLL.
If you don't want to deal with the shared memory, then you could always declare the data to be in its own shared data segment, and then each copy of the dll loaded into each process would only see that same memory.
|
|
|
|
|
Yes, I have tried this approach to no avail. Using the #pragma data_seg approach. Are there any really simple examples that show how to create such a system? For instance I think I fell down not knowing how to create the object in the application ready for when the dll loads. I had in the app AND dll:
#pragma daa_seg(".myseg")
myclass interface;
#pragma data_seg()
Is this correct or do I only have to declare it once in the app? I also tried a simple int arse = 0; in the dll and app then loaded the dll in the app, modified the int, and still the int was the same in the app (which was different to the modified dll). Just can't see why its failing. Of course if a solution could be found this way it would be preferable because I wouldn't have to learn all that COM stuff (although very interesting, and would be very useful in this instance, this way would save me lots of time ). Any chance of breaking it down into baby steps using an int in a dll and exe as an example?
Cheers, Alan.
|
|
|
|
|
by the way I did add the data_seg RWS stuff to the linker
|
|
|
|
|
Neat, thanks, always wondered what this COM stuff was all about.
|
|
|
|
|
im drawing xp thems items with the uxtheme dll ,
i can draw buttons and listview headers.
but how do i draw listview sortbuttons?
ive tried to use the "drawthemedbackground" api and pass the constants for the sortbuttons , but it just comes out as a normal listview header image
any idea how to draw the themed listview sort arrows?
(and i want to do it propperly , not just blit my own arrows or so)
//Roger
|
|
|
|
|
I had this problem, but then found this[^] and this[^].
"The way of a fool seems right to him, but a wise man listens to advice" - Proverbs 12:15 (NIV)
|
|
|
|
|
i try to search a user's all threads on the forum.
i.e. user PeterABC posted few threads, i type "PeterABC" for searching and get responding as "no such ...", but the user is definitely there!
so i guess there is the forum can't search threads, right?
thx
includeh10
|
|
|
|
|
You can click on the user's icon in the list, which takes you to the who's who part, from which you can see all postings by that user.
Steve S
|
|
|
|
|
I'm currently working on a videosurveillance software.
I have to display, as fast as possible, sequences of bitmaps, with
streching possibility.
I'm using VisualC++ 6.0, and I'm looking for someone who tried
different ways to display such images :
- drawdibdraw family functions
- strechdibits functions
- opengl texture mapping
- directx
- ... others ?
My goal is to find the FASTEST way to do it, whatever method.
Thanks
Mickey
|
|
|
|
|
directx or open-gl.
directx is faster, easier and better than open-gl.
includeh10
|
|
|
|
|
Presuming you mean 'fastest' in the context of the method that renders fastest (as opposed to the fastest method to implement), you will be looking at DirectX or OpenGL. They utilise the hardware rendering pipeline on the graphics card which essentially supplies the monitor with display information. They are ultra low-level, incredibly fast, optimised drawing interfaces mainly used in games (cos the faster the frame rate, the better). Ain't nothing gonna beat them two. DirectX is Windows (and XBox) only, whilst OpenGL is cross platform (though is unsupported on XBox cos its Microsoft!). All XBox games utilise DirectX. If your looking for the fastest to implement, then GDI's strechdibits function is quick and easy to setup, though is miles slower than DirectX or OpenGL cos it don't directly interface with the graphics hardware. Hope this helps.
|
|
|
|
|
AFAIK, SetDIBitsToDevice() is about the best you can do within GDI. Staying within GDI has many advantages (good device support, font rendering, portability, no redistributables to worry about), but if you don't need these then you may get some extra frames by going with something like OpenGL or DirectX (assuming the one you choose has good drivers for your video card).
Shog9
Let your mercy spill / On all these burning hearts in hell
If it be your will / To make us well...
|
|
|
|
|
Hi,
i want to display a bmp picture in a MFC dialog, I thought this couldn't be difficult, so i tried the following code in OnInitDialog:
HBITMAP hbm = NULL;
CStatic statBMP;
hbm = (HBITMAP)LoadImage(
NULL,
"D:\\mybmp.bmp",
IMAGE_BITMAP,
0,
0,
LR_LOADFROMFILE);
statBMP.Create(
NULL,
WS_VISIBLE | WS_CHILD | SS_CENTERIMAGE || SS_BITMAP,
CRect(100,100,10,10),
this))
statBMP.SetBitmap(hbm);
Looks good, doesn't it ?
But this f***ing code doesn't want to work !!!! What else can i do ?
Thanks!
|
|
|
|
|
hello there,
just go the resource tab on the lft hand window .
now drag and drop the picture control on it.
then just select the properties in that select the
bitmap id so taht will be automatically displayed on the dialog box
try it and give the reply
Thanx
TAKE CARE
|
|
|
|
|
First, thank you!
... i don't know what you mean with "now drag and drop picture control on it" ?
what is picture control ? i use the german version of visual studio
Thanks
|
|
|
|
|
even if u r using the german version of VC
u will be having the toolbox when u select the resource tab and when double click the dialog box i mean when u see the dialog box then u an see the toolbox in that there is a picture control just pull or select that control and draw that on ur dialog box .
after that select the property of that control by right clicking taht picture control now what u have to do is just give the id of the Bitmaop image u want to dispaly .
this bitmap has to be in ur VC project
ok try this thiong and do reply
bye
Thanx
TAKE CARE
|
|
|
|
|
...now i got you! I know that, and it works! But that what i want to do is to load the bitmap at runtime!
thanks
|
|
|
|
|
Are hbm & statBMP members of your dialog? Cause if you declare them in OnInitDialog they are destroyed and go out of scope when OnInitDialog returns.
|
|
|
|
|
Yes, they are members of the dialog!
|
|
|
|
|
hph wrote:
WS_VISIBLE | WS_CHILD | SS_CENTERIMAGE || SS_BITMAP,
You need to change this to:
WS_VISIBLE | WS_CHILD | SS_CENTERIMAGE | SS_BITMAP, You should also have your rectangle so that the right coordinate is greater than the left coordinate and the bottom coordinate is greater than the top coordinate. If you want the static to be 10x10, use
CRect(100,100,110,110) Hope this helps,
Ryan "Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"
|
|
|
|