|
opensoar wrote: HMODULE hFlashDLL = GetModuleHandle( "NPSWF32.dll" );
Are you sure that this dll is loaded into memory at this point? You don't error check the returned value hFlashDLL .
MVP 2010 - are they mad?
|
|
|
|
|
Yep - it's loaded. Like I said in my original message, I listed the code with error checking etc. removed and the values I get back seem ok.
|
|
|
|
|
opensoar wrote: hFlashDLL and flash_stop_func appear to be valid but when I call the function itself I get an access violation.
My apologies, I missed this in your original post. Is there any more information from the access violation to give any indication of what it is complaining about? Also are you sure that native_ShockwaveFlash_StopPlay does not require any parameters?
MVP 2010 - are they mad?
|
|
|
|
|
>> Also are you sure that native_ShockwaveFlash_StopPlay does not require any parameters?
That was my thought too Richard - docs are a bit thin on the ground and that function name doesn't match any in the the other Flash API docs I've seen so I'm thinking those calls are wrapped somehow and that my part of the problem.
Nothing more useful in the error message as far as I can tell.
|
|
|
|
|
I just Googled native_ShockwaveFlash_StopPlay and found one hit; someone else complaining of the same issue. My only suggestion is to try and get some documentation on this library from someone else around the world.
MVP 2010 - are they mad?
|
|
|
|
|
Hi Members
How i get Screen capture?I am using dialog based application i want to get Screen capture and save into .dat format.
Please help me
|
|
|
|
|
See Barry's Screen Capture[^]
I used the CodeProject "search" feature to arrive on that result.
“Follow your bliss.” – Joseph Campbell
|
|
|
|
|
Member 6864839 wrote:
How i get Screen capture?
See here for an idea.
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"Man who follows car will be exhausted." - Confucius
|
|
|
|
|
thanks both of you for reply.I use this code
HDC m_hdcMem,hdc;
HBITMAP m_Bitmap,m_OldBitmap,hMainBmp ;
int x=800;
int y=600;
hdc=GetDesktopWindow()->GetDC()->m_hDC;
m_hdcMem= CreateCompatibleDC(hdc);
m_Bitmap = CreateCompatibleBitmap(hdc,x,y);
m_OldBitmap=(HBITMAP) SelectObject(m_hdcMem, m_Bitmap);
BitBlt(m_hdcMem, 0,0,x,y, hdc,0,0,SRCCOPY);
hMainBmp =(HBITMAP) SelectObject(m_hdcMem, m_OldBitmap);
CImage m_Image;
m_Image.Attach(hMainBmp);
m_Image.Save("C:\\image.bmp");
m_Image.Detach();
DeleteDC(m_hdcMem);
DeleteObject(hMainBmp );
DeleteObject(m_OldBitmap);
It's working for me.
Now i want to save file in format of .DAT.
Please help me
|
|
|
|
|
Member 6864839 wrote: Now i want to save file in format of .DAT.
There's no such .DAT file. What you've got by capturing the screen is a bitmap, and you just save it to the disk by providing any extension you want to the filename. Or if by .DAT you want to have a file format that your app can only handle, encrypt (search the site) the bitmap and save it to ".DAT format".
“Follow your bliss.” – Joseph Campbell
|
|
|
|
|
ok i use this code but file not save in my disk.
m_Image.Save("C:\\image.dat");
|
|
|
|
|
Take a look at the example at the end of the documentation for CImage::Save()[^]. Because you said "image.dat", the call didn't know the format. You will need to explicitly specify it as bitmap format by doing it this way:
m_Image.Save("c:\\image.dat",ImageFormatBMP);
“Follow your bliss.” – Joseph Campbell
|
|
|
|
|
Thanks it's working.
Thanks once again...........
|
|
|
|
|
I'm glad I could help.
Shameless plug: May I please ask you to mark the helpful replies as "Good Answer" by clicking on the appropriate posts?
“Follow your bliss.” – Joseph Campbell
|
|
|
|
|
I have a dll that needs to share data among all instances. How can I accomplish this? I've tried a multitude of compiler-specific #pragma's (visual studio 2008 for anyone who's asking) and no matter what I do, I cannot share the variables across all instances.
MSDN says memory-mapped files are one of several solutions, so any info on that too would be welcome.
|
|
|
|
|
|
I've tried that, and it didn't work
I remember reading somewhere (on MSDN) that the #pragma data_seg() directive should not be used with classes that require deep copy constructors. Unfortunately, the data I want to share is an std::list.
The page you linked me to goes on to say "Because of these restrictions, Microsoft does not recommend sharing C++ objects between processes."
They also don't recommend sharing pointers, so what alternative do I have?
|
|
|
|
|
Sauce! wrote: They also don't recommend sharing pointers, so what alternative do I have?
In the same page:
In general, if you want to use C++ to share data between processes, write a class
that internally uses a memory-mapped file to share data, but do not share the class instances themselves. This might require special care in developing such a class, but it enables application developers to fully control the side effects of sharing data.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
I guess I have a bit of reading to do, this sounds complicated
|
|
|
|
|
BTW, why do you need to share data across several instance of the dll ?
|
|
|
|
|
I guess (is just a guess) you may serialize objects in memory mapped files.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
You can't share a std::list as it allocates nodes on the heap and uses pointers. Boost[^]'s Boost.Interprocess[^] library might be what you're looking for. Among its numerous features are containers like STL's but which can be shared between processes.
Steve
|
|
|
|
|
I use memory mapped files to do exactly this in several places in our [XP embedded based] system. (The trick is to use a mutex to ensure that only one instance does the initializing and the rest just open the memory mapped file.)
|
|
|
|
|
It's not particularly necessary that each instance of the dll share a particular variable - I could instead have each instance of the dll send a message to my application (which loads the dll) and have my app use the message to add the new value to the end of the list. How does that sound?
I'm attempting to simulate input latency by installing a keyboard and mouse hook that records all input, blocks it, and then resends it after a specified interval. I'll probably have trouble differentiating between messages I'm recieving from the system, and messages that I have forwarded after the appropriate interval, however that is a river I'll have to cross when I get to it.
So I guess I'll see what I can do about forwarding the messages directly to my application, where they will then be pushed onto a list (it should be a fairly trivial matter)
edit: is there any way at all I can send a message using the win32 SendMessage() along with some user data, like a flag? It would make my life a hell of a lot easier :P
|
|
|
|
|
Sauce! wrote: is there any way at all I can send a message using the win32 SendMessage() along with some user data, like a flag?
If your data is two DWORDs or less (and WPARAM and LPARAM), just use a WM_USER message or see RegisterWindowMessage(). If longer, use WM_COPYDATA.
|
|
|
|