|
Hey João (since I know you'll be the first to answer this (and answer it correctly too ))
Is it possible to detect when the user has pushed the power-off button and do perform some actions (like pausing an MP3 or saving data) before the device is turned off? The device does most of this itself, but in the case of the MP3, there are some..."issues" that I think I can fix, if I just knew when the device was going off.
I have some nifty CE_USER_NOTIFICATION-based functionality to determine when the device is turned back on, but there is no notification flag for power off (NOTIFICATION_EVENT_WAKEUP is for power on).
Thanks in advance.
The kindest thing you can do for a stupid person, and for the gene pool, is to let him expire of his own dumb choices.
[Roger Wright on stupid people]
We're like private member functions
[John Theal on R&D]
|
|
|
|
|
Hi!
I think that the correct answer is that there is no way to do it. Take my answer with a grain of salt because I'm not sure about this. I thought about intercepting the power button, but this will leave out the power off timer. I tried using Spy to check if the system does send a message to the top-level active window (or desktop), but got nothing.
If I come up with a better answer, I'll post it here.
Regards,
João Paulo
|
|
|
|
|
Well, that sucks, but thanks anyways.
The ideas I had were trying to handle VK_OFF in a OnKeyDown or similar. Or hoping that a WM_POWERBROADCAST-type message is sent.
When I was playing around, it didn't seem like either of this methods worked, but when it comes to CE, I'm never sure.
The kindest thing you can do for a stupid person, and for the gene pool, is to let him expire of his own dumb choices.
[Roger Wright on stupid people]
We're like private member functions
[John Theal on R&D]
|
|
|
|
|
Hello All,
How to get the redirected URL or Curent URL from the HTML Viwer/Container ?
Suggestions are most welcome!!!
Thanks & Regards
AKS
//------------------------------------------//
Note: FYI : Sample Code
//------------------------------------------//
void CSTHtmlDialog::CreateHtmlWindow()
{
if (m_HtmlViewInstance == 0) {
m_HtmlViewInstance = ::LoadLibrary(L"htmlview.dll");
}
VERIFY(InitHTMLControl(AfxGetInstanceHandle()));
DWORD dwStyle = WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS;
RECT rect;
GetClientRect(&rect);
m_hwndHtml = ::CreateWindow (DISPLAYCLASS,
NULL,
dwStyle,
rect.left,
rect.top,
rect.right,
rect.bottom,
m_hWnd,
0,
m_HtmlViewInstance,
NULL);
CString url = "http://www.vision.com";
BSTR bstrURL = SysAllocString(url);
::SendMessage(m_hwndHtml, DTM_NAVIGATE, 0, (LPARAM)bstrURL);
SysFreeString(bstrURL);
}
|
|
|
|
|
Handle the NM_NAVIGATECOMPLETE notification and check if the pnmHTMLView->szTarget contains the URL you want (check help for more info).
Regards,
João Paulo
|
|
|
|
|
i want to re-use my dialog-resource that i created in evc3 in another evc3-project.
is there any way i can do that? export and import only seems to work for icons...
thx, Daniel
|
|
|
|
|
|
i tried to open some images in my app, but they don't like the way they should. I opened them with pocketIE, but they still look the same. (this all happened on the emulator, because my ipaq is broken, but i think it will be the same on the device)
i think it is because pocketIE tries to resize them but this doesn't work.
it is a grey and white jpg sized 393 x 202 Pixels. PocketIE kind of shrinks it to square-size and then duplicates the image. very strange. what can i do?
thx, Daniel
|
|
|
|
|
I am trying to close a MFC-EVC++-Application from a modeless Dialog that was created as a child window of the MainFrame. I tried it with:
::SendMessage(this->GetParent()->m_hWnd, WM_CLOSE, 0, 0);
but this does not exactly do what I want.
Most of the time, it closes all open windows (i.e. the modeless dialog and the MainFrame), but the Aplication with the modeless dialog still remains in the "running programs"-list (settings->memory).
In some occasions however, it completely closes the application.
I think, something is not working correctly in my code....
thx, Daniel
|
|
|
|
|
Maybe this is due to the interaction of the modeless dialog and its parent. Try this: when pressing the button to close the frame, close the dialog and post a WM_CLOSE message to the frame:
GetParent()->PostMessage(WM_CLOSE);
Regards,
João Paulo
|
|
|
|
|
but that's quite the same than my previous code.
it still leads to problems
thx, Daniel
|
|
|
|
|
I would have to see more code to help you.
Regards,
João Paulo
|
|
|
|
|
thx for the help-
the problem seems to be somewhere else. it also doesn't work if i try to do it the other way round, i.e. to close the dialog from the mainFrame. to e more detailed, it works in some cases, but most of the times after i worked a little bit in the dialog, my app crashes when trying to close both. probably, somewhere in my dialog i did not free memory or something like that...
here's some of my code anyway:
I have a PPC app that start and shows a modeless dialog:
Code:
//in MainFrame.h:
CComPortDlg* m_pDlg;
//in MainFrame.cpp:
CMainFrame::CMainFrame(){
m_pDlg = new CComPortDlg;
}
//when clicking menu-entry "End":
if(this->m_pDlg->m_hWnd != NULL){
this->m_pDlg->ShowWindow(SW_HIDE);
this->m_pDlg->DestroyWindow(); //close dialog
//the destroyWindow() usually take VERY long and makes the whole PDA crash...
}
SendMessage(WM_CLOSE,0,0); //close mainframe
//in Destructor:
CMainFrame::~CMainFrame(){
delete m_pDlg;
}
is this the right way to deal with modeless dialogs?
thx, Daniel
|
|
|
|
|
Hi there...
Im in way to develop a Pocket PC application which places a window in the taskbar. After placed a shortcut in the \windows\autostart folder the application is running each time the device starts up. But after starting the device the Password and the User Information Dialog appering...my application in the taskbar also ... How can i determine if these dialogs are closed before my application is placing her (;)) window in the taskbar?
Any ideas or experience in this kind of problem?
Thanks for reading
|
|
|
|
|
what's the best way in ecv3 to show a html-file that was read from the local file system??
my plan was to use sHtmlView (a class based on htmlview, that provices setHtml(CString) to show stuff.
I wanted to use CreateFile and ReadFile to open the file and give the buffer (that was filled by ReadFile) to setHtml.
MyProblem: ReadFile requires a char[X]-buffer that has to have a constant size. But of course I don't know the HTML-file's size...
thx, Daniel
|
|
|
|
|
slomoman wrote:
But of course I don't know the HTML-file's size...
Use GetFileSize() ...
Regards,
João Paulo
|
|
|
|
|
but a char array still needs a CONSTANT size, not a variable size, right?
Or is there another way when passing the parameter to readFile...?
I'm quite new to Strings in C++.....
thx, Daniel
|
|
|
|
|
slomoman wrote:
but a char array still needs a CONSTANT size, not a variable size, right?
Sure, but you should not allocate it statically. Use the value that GetFileSize() returns to create a dynamic char array using new or other memory allocation mechanism you find more convenient. It should be something like this:
TCHAR *pBuffer;
DWORD dwSize = GetFileSize(hFile);
pBuffer = new TCHAR[dwSize];
if(pBuffer)
{
delete [] pBuffer;
}
else
{
}
TCHAR is the UNICODE equivalent of char .
Regards,
João Paulo
|
|
|
|
|
I wrote an MFC app (PPC2002), but I can't close it. When I click (x) in the upper right corner, the window disappeards, but my app is this there in the task-manager.
I think PocketPC wan't it like that because the same happens with pocketword and all the other apps. but for developing and debugging, i don't like that.
Is there a way I can really close my app?
thx, Daniel
|
|
|
|
|
|
ok, i found out more on that:
Normally, I can close my app (ppc2002, evc3) and restart without problem. however, if I call the following line more than three times, i cannot close anymore and the PPC crashes when i try to close.(soft-reset).
void CSTHtmlDialog::SetHtml(CString* strHtml){
::SendMessage(m_hwndHtml, DTM_ADDTEXTW, FALSE, (LPARAM) (LPCTSTR)*strHtml);
m_hwndHtml is a CDialog that uses htmlview.dll and <htmlctrl.h>.
What can i do? i'm going crazy
thx, Daniel
|
|
|
|
|
slomoman wrote:
m_hwndHtml is a CDialog
Is it a CDialog or the child HTML Viewer control?
Regards,
João Paulo
|
|
|
|
|
actually, it is a CSTHtmlDialog from http://www.codeproject.com/ce/sthtmldialog.asp. But that is dereived from CDialog.
thx, Daniel
|
|
|
|
|
Have you tried using CSTHtmlDialog::SetHtml() ?
Regards,
João Paulo
|
|
|
|
|
João Paulo Figueira wrote:
Have you tried using CSTHtmlDialog::SetHtml()?
Yes, that's what i used and that's what caused the problem...
thx, Daniel
|
|
|
|