|
Hi, guys.
Need some help here.
I've been struggling against what I believe is a bug for a week now.
I have a C# compact framework application that displays a Login form. something like :
<br />
Login frmlogin = new Login();<br />
frmLogin.ShowDialog();<br />
if (frmLogin.DialogResult != DialogResult.OK)<br />
{<br />
Application.Exit();<br />
}<br />
frmLogin.Dispose();<br />
And the Login form has a "OK" button, with the following event handler :
<br />
private void btnOK_Click(object sender, System.EventArgs e)<br />
{<br />
try <br />
{ <br />
loginObj.DoLogin();<br />
this.DialogResult = DialogResult.OK;<br />
}<br />
catch (Exception ex)<br />
{<br />
MessageBox.Show(ex.Message,"Login Failed");<br />
}<br />
}<br />
The loginObj object is my business object that handles login data validation, and other operations. The DoLogin() method validates the login data, and it throws an exception if there's any required data missing.
When the exception is thrown, the message box is displayed, and when the user closes the message box, the contents of the Login form disappears! The contents of the main form is displayed instead. But the title of the form still shows "Login". The form hasn't been closed, because I can't click on the main form's buttons.
When I check at the running programs, the login window is still there. If I choose "Stop" on the Running Programs tab of the Memory Settings, the Login form is closed in a way like the DialogResult was set to DialogResult.OK and the program works normally.
I believe this behavior has nothing to do with the loginObj object or with the exception it throws, since when I displayed another message box on the same form to test it, the same thing happened.
Another interesting thing is that it only happens on the login form. I made tests to show message boxes on other forms displayed with ShowDialog(), but there were no problems.
Anyone has seen something like that? Any ideas?
Any help will be greatly appreciated!
|
|
|
|
|
I just found what was wrong!
I was setting the form's mainMenu outside InitializeComponent() method.
I was doing :
<br />
private void MainForm_OnLoad(object sender, System.EventArgs e)<br />
{<br />
loginObj.Load();<br />
this.mainForm = this.myMainForm;<br />
}<br />
and somehow this was causing the strange behavior. Go figure!
So, be aware that setting the form's mainMenu outside InitializeComponent() method will make the contents of your form disappear after showing any form with ShowDialog() or showing a MessageBox from that form.
|
|
|
|
|
i want to call a printer thats connected to a terminal that my PDA is connected to, so that i can print stuff on my PDA. how do i do that in coding? and is there any support for printer stuff in vb.net? i'm using it to develop a smart device application for my pda. thanks!
|
|
|
|
|
Hi,
I need to draw a dynamically generated 256x256 grayscale bitmap on screen.
Drawing it "pixel by pixel" is extremely slow. (several seconds)
Drawing it on an ofscreen bitmap and then blitting it on screen is slightly faster, but still unaceptable.
On the full framework I got around to accessing the bitmap data, and accessing the pixels directly, giving instant results.
Is there any way to achive this on the Compact Framework?
(or any other method that works...)
If the "AddressOf" worked for the bitmap, so I could get a IntPtr to it, I think I could then go in there and set the pixel data myself... But I was unable to find a way to do that.
(will C# do the trick?)
The current code:
Dim ImgRAW(256, 256) As Byte
' GetImage(Imgraw) '... Fill up dynamic image
Dim offbmp As New Bitmap(256, 256)
For scan = 1 To 255
For x = 1 To 255
t = ImgRAW(scan, x)
offbmp.SetPixel(x, scan, Color.FromArgb(t, t, t))
Next
Next
oG.DrawImage(offbmp, 400, 100)
Hope someone can help,
Thanks.
|
|
|
|
|
Hi...I'm working on the windows mobile 2003 platform (e200 spv) and would like to get the phones' location info and write it to a txt file.
Any suggestions?
dboy.spv
|
|
|
|
|
I thought I would post this here because I can't spot the error. This is my first attempt to code for a Pocket PC. The following code works fine on the desktop:
TCHAR szFilePath[MAX_PATH];
wsprintf(szFilePath, TEXT("%sTest.txt"), this->szAppRootDirectory);
HANDLE hFile = CreateFile(szFilePath, GENERIC_READ, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
if ( hFile == INVALID_HANDLE_VALUE )
{
MessageBox(hwnd, TEXT("Fatal error: Unable to open file."), NULL, MB_OK);
return R_ERROR;
}
DWORD dwBytesRead;
DWORD dwFileSize = SetFilePointer(hFile, 0, NULL, FILE_END);
TCHAR *szBuffer = new TCHAR[dwFileSize + 1];
SetFilePointer(hFile, 0, NULL, FILE_BEGIN);
ReadFile(hFile, szBuffer, dwFileSize, &dwBytesRead, NULL);
CloseHandle(hFile);
szBuffer[dwFileSize] = '\0';
Unfortunatelly, szBuffer fills w/ garbage (boxes) on the Pocket PC. Can anyone spot the error here? Thanks in advance.
|
|
|
|
|
Wouldn`t GetFileSize be an easier way to get the size of the file then moving the filepointer around?
The fact that boxes are displayed could be that the characters in the file are ANSI characters(1byte) and you compiled your application for Unicode (TCHAR is then a wide char (2byte) ), or the other way around...
Or the file contains unicode characters that are not supported by the font on your device...
Hope this can help you further...
Greetings,
Davy
|
|
|
|
|
That was the problem. Thanks.
|
|
|
|
|
Hello,
I wrote a software for WM2003 with eVC4 in C++. I post it in PocketPCFreeware here http://www.pocketpcfreewares.com/fr/index.php?soft=1299. Sorry it's in french but I plan to translate it in english.
Some users ask me the compatibility of the software with PPC2002: it doesn't work. I forgot something ? Have I to compile the soft with eVC3 ? Is there a problem with the compack framework (it doesn't work with it) ? Have I to add some DLL's ?
Please help me ...
Best regards
PS: sorry about my bad english
|
|
|
|
|
|
hi all,
i am trying to display a bmp image on xda o2.i have used bitblt function to display the source on the screen.....
but when i port it to the xda....it doesnot show up....
can u help with that.....
sasi
|
|
|
|
|
Hello,
Try following:
m_ctlTxtPicture.SetBitmap( ::LoadBitmap(AfxGetInstanceHandle(), MAKEINTRESOURCE(IDI_BMP_SUCCESS)) );
Here,
--> m_ctlTxtPicture is a control variable of Picture Control (Container for
the bitmap)
--> IDI_BMP_SUCCESS is resource ID for the bitmap.
Thank you
Mahesh J. Chavda
|
|
|
|
|
thanks for reply.
actually i am trying to port the application on arm processor O2 xda model(pocket pc 2000).
it shows on the emulator but not on the pocket pc.is ther anything else i have to change...to port on arm processor????
sasi
|
|
|
|
|
|
I am building an application for pocket pc - Infra red TV remote using pocket pc.
Which pocket pc do you recommend? The OS should be win CE 3.0
|
|
|
|
|
i would recommend pocket pc 2000 and 2002 .
sasi
|
|
|
|
|
I want a write driver iam new to this field can any one give me flow how to write a device driver in wince
|
|
|
|
|
Hello
it would be very helpful for beginners like me, if any body could post an article on in WinCE Development.
Regards
Sreekanth Muralidharan
Hyderabad
|
|
|
|
|
|
Hi guys,
I am using strtod() function to convert a string "123.4" to float 123.4
It works fine in VC++. But when I enter the same code in evc++, its giving me the following error-
error C2664: 'strtod' : cannot convert parameter 1 from 'class CString' to 'const char *'
No user-defined-conversion operator available that can perform this conversion, or the operator cannot be called
My code:
char *stop;
UpdateData (TRUE);
input=strtod(m_display, &stop);
x=input;
m_display is the CString variable, input is double.
I type casted the m_display -
input=strtod((LPCTSTR)m_display, &stop);
I got this error -
error C2664: 'strtod' : cannot convert parameter 1 from 'const unsigned short *' to 'const char *'
Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
I am having major problems since yesterday night. totally frustrating! The float to string gives me error too.
-hithesh
|
|
|
|
|
You've defined UNICODE . This means that CString manages an array of WCHAR s, not of char s.
To handle this behaviour-switching between UNICODE being defined and not defined, use the macros in tchar.h . The documentation for each wrapped function shows the equivalent tchar.h name under "Generic-Text Routine Mappings". For strtod , the equivalent API that operates on TCHAR s is _tcstod .
Stability. What an interesting concept. -- Chris Maunder
|
|
|
|
|
Mike,
Thanks. So instead of strtod, I use _tcstod?
I am a VC++ newbie. an example would be great.
thanx.
-hithesh
|
|
|
|
|
Hi!!!
I have a pda application that uses a dll that I made.
That dll has some images that i load as an embedded resource, when i run the application, it takes some time t load all images and i can see in the emulator the images loading... What can I do to make the images load at the same time??
Thanks in advance
|
|
|
|
|
The best solution I found, when loading a lot of images when the program starts, was to display a splash screen with a progressbar.
That way, the few seconds it taks to load seem to go faster.
|
|
|
|
|
I Have two problem to manage Pocket PC 2002 Network Connection :
1st. I have create Bluetooth application and it's work fine when bluetooth is active. But when inactive my application is always error. How can i detect Bluetooth is active or not by software, and also how can i activate bluetooth manually by my software ?
2nd. I try to send data by GPRS, it always succeed when GPRS is active. But when GPRS is inactive it's always error. So how to create software to configure the GPRS connection and connect the GPRS manually without using Net.WebRequest and CMHELPER ?
Thank's for support.
|
|
|
|