|
Hi Mark,
Thanks for the tips on setting hwnd ... I have searched almost an hour to find this anwer ...
|
|
|
|
|
|
Hi !
I would like to create a simple application with C++ Builder which can play an SWF or WMV file (looping) full screen like dynamic desktop.
My problem in which I would like to ask your help :
- How can I set a Form1 to Desktop level ? I mean, how can I set the application form to stay like desktop the very most back of all other windows as well as desktop icons visible, etc ?
I already tried SenToBack() and ZORder(0) but none of the push the application below desktop icons.
Many thanks for your time and help,
Moore
|
|
|
|
|
You can't push the application behind the desktop icons but in front of the actual desktop because the desktop icons and desktop form one window.
If you have Vista, have you tried DreamScene? I believe it has the ability to play WMV files.
Regards,
--Perspx
"A refund for defective software might be nice, except it would bankrupt the entire software industry in the first year." -Andrew Tanenbaum
"Einstein argued that there must be simplified explanations of nature, because God is not capricious or arbitrary. No such faith comforts the software engineer." -Fred Brooks
|
|
|
|
|
Well, it is not entirely true. E.g visit this site : http://zmatrix.sourceforge.net , download and install it on an XP. you will see thats possible.
I just dont know, how...
Moore
|
|
|
|
|
Hello!
If you know some DirectX/DirectShow you could try creating an overlay for the screen, set the desktop to overlay-color and play the movie file you wish onto the overlay surface. That could work, but you would get ugly results with "shadow" effects like shadowed text under the icons on the desktop.
|
|
|
|
|
Hey everybody
I heard a while ago about an API using WMI that allow me to get notifications of any change of files in the system.
Anyone heard of such API? and if so, anyone can tell me what how it is called?
I looked for it for a while, without much success...
Thanks a lot!
|
|
|
|
|
Not WMI, but there's FindFirstChangeNotification/FindNextChangeNotification.
For WMI, Googling "wmi file event notification" yields a few results.
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Thanks
|
|
|
|
|
|
You could use the api ReadDirectoryChangesW() as well. Check here[^] for code snippet.
Regards,
Jijo.
_____________________________________________________
http://weseetips.com[ ^] Visual C++ tips and tricks. Updated daily.
|
|
|
|
|
Hi,
I am running a WinCE6.0 Stream interface Driver on a DTE device which will open a handle to Serial port which is
connected to a modem.WriteFile API returns non-zero Value, but NumberofbytesWritten parameters is coming as Zero.
The Windows CE 6.0 device is a DTE terminal and when connected to PC (Another DTE)) over NULL Modem cable with hyperterminal, all the data from the are seen on the hyperterminal, and WriteFile API fills the NumberofbytesWritten is exactly the same as the
bytestoWrite.
When the CE6.0 DTE device is connected to DCE Modemdevice using a Straight serial cable, WriteFile API
is succedding by returning Non-Zero Value, but NumberofbytesWritten parameters is coming as Zero.
The following is the DCB in the driver:
dcb.BaudRate = m_BaudRate;(115200)
dcb.fBinary = TRUE;
dcb.fParity = TRUE;
dcb.fOutxCtsFlow = TRUE;
dcb.fOutxDsrFlow = FALSE;
dcb.fDtrControl = DTR_CONTROL_ENABLE;
dcb.fDsrSensitivity = FALSE;
dcb.fTXContinueOnXoff = TRUE;
dcb.fOutX = FALSE;
dcb.fInX = FALSE;
dcb.fErrorChar = FALSE;
dcb.fNull = FALSE;
dcb.fRtsControl = RTS_CONTROL_HANDSHAKE;
dcb.fAbortOnError = FALSE;
dcb.ByteSize = 8;
dcb.Parity = NOPARITY;
dcb.StopBits = ONESTOPBIT;
Also, I am setting EscapeCommFunction(m_hCOMHandle,SETDTR);
On the hyperteminal I have the following setting:
baudrate = 115200
Data bit = 8
Parity=None
StopBit=1
FlowControl=None
Also, with the same hyperterminal setting with PC(Hyperterminal) connected to Modem over Straight SErial cable,
I am able to fire the AT Commands from the PC(hyperterminal) to the modem.
Also CommTimeout, I have set the following:
CT.ReadIntervalTimeout = MAXDWORD;
CT.ReadTotalTimeoutMultiplier = 0;
CT.ReadTotalTimeoutConstant = 0;
CT.WriteTotalTimeoutMultiplier = 0;
CT.WriteTotalTimeoutConstant = 100;
-Can a timeout issue cause WriteFile Still succeed and Numberof Bytes Written as zero?
- In hyperterminal Flow Control None, what are the Flow control affected in the DCB?
Can somebody give me some hints on the same.
Thanks..
|
|
|
|
|
My project is SDI project and I add some dialog in this project.
In this dialog I need to access some variable in CDocument class so I write this code
CTestDoc* pDoc = (CTestDoc*)GetDocument();
I got this error
"Error 3 error C3861: 'GetDocument': identifier not found"
Although I #include "TestDoc.h" at begining of file the error is same
Please advise me how to solve this problem.
|
|
|
|
|
You're trying to call a function called GetDocument() that doesn't exist
in the context of where you're calling it from.
If you're calling it from within your dialog class code then you need to
implement a method called GetDocument - CDialog doesn't have one.
A few ways to implement this:
Pass a reference to your document into the dialog.
Make the document globally accessible.
Use a CFormView instead of a CDialog. CForm view has a GetDocument().
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
I'm working on a GSM application where i'm supposed to send a text msg using AT commands by detecting a com port, however before simulating the comp port i would like to know how we can detect the whether which com port is available.
|
|
|
|
|
|
Hi.
How can I create a working thread in a MFC regular dll and How can I load such a dll in a application?
Never Change My Goal!
|
|
|
|
|
First make sure you've covered the requirements for a regular DLL
that uses MFC (taken from the docs):
1) Compiled with _USRDLL defined, and if the DLL links to MFC dynamically,
_AFXDLL must be defined.
2) The DLL must instantiate a CWinApp-derived class.
3) The DLL uses the DllMain provided by MFC. Don't add your own.
Place all DLL-specific initialization code in the InitInstance
member function and termination code in ExitInstance as in a normal
MFC application.
In the dll you can use AfxBeginThread() to create worker threads.
If you don't know how to actually use a DLL, you may want to study:
DLLs[^]
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Thanks Mark.
But When I did it as you said,it does not seem to work at all!
can you give me some example code?
Never Change My Goal!
|
|
|
|
|
Not working how?
Please list any compiler errors, linker errors, runtime exceptions, etc.
To start with, are you able to successfully call a function in your DLL?
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
there is no compiler errors,linker errors..
the dll loads successfully,and I can call the function in the dll too.
and here is the funtion in the dll:
UINT threadproc(LPVOID lparam)
{
::MessageBox(NULL,"call the function succeefully","info",MB_OK);
return 0;
}
extern "C" void __declspec(dllexport) dllext()
{
::MessageBox(NULL,"call the function succeefully in dllext()","info",MB_OK);
CWinThread*pThread=AfxBeginThread(threadproc,NULL,THREAD_PRIORITY_NORMAL,0,CREATE_SUSPENDED ,NULL);
pThread->ResumeThread();
}
and here is the function in a normal MFC application:
void CMainFrame::OnBeginthread()
{
typedef void (*Pdllfun)();
HINSTANCE hdll=LoadLibrary("thread.dll");
if(hdll==NULL)
::MessageBox(NULL,"can not laod the dll","",MB_OK);
Pdllfun pdllfun=NULL;
pdllfun=(Pdllfun)::GetProcAddress(hdll,"dllext");
if(pdllfun==NULL)
::MessageBox(NULL,"can not laod the dll funion","",MB_OK);
pdllfun();
FreeLibrary(hdll);
}
if I do not call the pThread->ResumeThread() function which in the dll,everything will be ok.
but once I call the pThread->ResumeThread() function,the main application will crash.
and the errors it returns to me is:
0x00fd102d instruction references "0x00fd102d" memory can not be written
Never Change My Goal!
modified on Monday, November 10, 2008 3:27 AM
|
|
|
|
|
The fact that you're using LoadLibrary to load the dll at run time makes a HUGE difference to your question.
In this case, I wouldn't go any near MFC for the DLL at all, just plain vanilla Win32.
I can see one gaping problem though - after you've called resume thread, you return from dllext(), and the promptly call FreeLibrary (). That will (as the name says...) free the library. As you only loaded it once, that will also unload it from your memory. Then windows does a context switch (or could have done at any time - or even simultaneously) to your thread. Which tries to run code that doesn't exist anymore...
Imagine Wile E Coyote running off a cliff, running into mid air for a few seconds, looking down... that's what you've done to your code.
Iain.
|
|
|
|
|
thanks Iain.I have solved the problem.
The fact that you are right!
void CMainFrame::OnBeginthread()
{
typedef void (*Pdllfun)();
HINSTANCE hdll=LoadLibrary("thread.dll");
if(hdll==NULL)
::MessageBox(NULL,"can not laod the dll","",MB_OK);
Pdllfun pdllfun=NULL;
pdllfun=(Pdllfun)::GetProcAddress(hdll,"dllext");
if(pdllfun==NULL)
::MessageBox(NULL,"can not laod the dll funion","",MB_OK);
pdllfun();
::MessageBox(NULL,"hold the dll","",MB_OK);
FreeLibrary(hdll);
}
so..thanks Iain again!!
Never Change My Goal!
|
|
|
|
|
Iain Clarke wrote: Imagine Wile E Coyote running off a cliff, running into mid air for a few seconds, looking down... that's what you've done to your code.
Excellent!
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Iain Clarke wrote: I wouldn't go any near MFC for the DLL at all, just plain vanilla Win32.
If he's truly properly implemented a "regular DLL linked to MFC" as
described here[^]. there should ne no problems.
Probably some thread synchronization issues in the near future for kim_wu...
Thanks for handling the remainder of this thread!
Cheers,
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|