|
The callback article is cool, and I used the concept in our code.
In fact, I think the commandbar thing is a better solution than putting the "OK" and "Cancel" buttons in the titlebar at the top of the screen. However, I'd like to remove the "OK" button from the titlebar if it's possible.
Got any ideas?
------- signature starts
"...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001
Please review the Legal Disclaimer in my bio.
------- signature ends
|
|
|
|
|
Use this:
ModifyStyle(0, WS_NONAVDONEBUTTON, SWP_NOSIZE);
SHDoneButton(m_hWnd, SHDB_HIDE);
This can go in the OnInitDialog of your CPropertySheet .
|
|
|
|
|
Perfect! Thanks!
------- signature starts
"...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001
Please review the Legal Disclaimer in my bio.
------- signature ends
|
|
|
|
|
Hello to everyone again:
I am experiencing a troubling problem with stl strings. I will try to be as much precise as possible.
I have this definition, as my DLL must work under WIN32 and WINCE
<br />
#ifdef _UNICODE<br />
#define __tstring std::wstring<br />
#else<br />
#define __tstring std::string<br />
#endif<br />
One object (CContainer) has to build an string with different information obtained from a structure.
<br />
const TCHAR* CContainer::GetCurrentCommandText()<br />
{<br />
CCommands::LPCOMMAND pCommand = GetCurrentCommand();<br />
__tstring sReturn;<br />
sReturn.clear();<br />
if (pCommand)<br />
{<br />
CCommandToTextConvert* pText;<br />
pText= new CCommandToTextConvert(pCommand);<br />
sReturn.append(pText->GetSVOrigin());<br />
sReturn.append(pText->GetSVDestination());<br />
}<br />
GetSVOrigin and GetSVDestination have a similar code. I'll show GetSVOrigin:
<br />
const TCHAR* CCommandToTextConvert::GetSVOrigin() const<br />
{<br />
__tstring s;<br />
s.clear();<br />
if (m_pCommand->dLong > 0)<br />
{<br />
s.append(_T("Origin: "));<br />
s.append(m_pCommand->sOrigin);<br />
}<br />
return s.c_str();<br />
}<br />
The problem, as mentioned in the code is that when returning, the string gets spoilt. If I make s.c_str() before returning, the result is right. As a result, when trying to append the strings returned by the functions, as each one is wrong, the result is wrong^2
I also tried to do
<br />
const TCHAR* sFoo;<br />
sFoo= new TCHAR[200];<br />
sFoo = s.c_str();<br />
return sFoo;<br />
But the problem remains the same
What on earth can be the problem? Answers will be really welcomed.
José M Castellanos. Troubled rookie programmer
|
|
|
|
|
Jose M Castellanos wrote:
//Here the string is correct, someting like "Origin: main street"
return s.c_str();
//But the function returns something like "@X#R" (different each time)
You are returning a const TCHAR* to a local variable. After the function exits, that memory is freed, and your pointer is pointing to garbage.
Jose M Castellanos wrote:
const TCHAR* sFoo;
sFoo= new TCHAR[200];
sFoo = s.c_str();
return sFoo;
You are still returning a pointer to a local variable here (+ leaking 200 * sizeof(TCHAR) bytes).
Jose M Castellanos wrote:
Answers will be really welcomed
Potential memory leaks aside, if you want this to work you have to copy the string to the buffer you create:
_tcsncpy(sFoo, s.c_str(), 200);
though changing you interface to something like:
bool CCommandToTextConvert::GetSVOrigin(TCHAR* buff, int& size) const
where you allocate (and deallocate) the memory outside the function is a better solution.
Note: You will still have to copy the string to buff .
HTH
Jonas
“Our solar system is Jupiter and a bunch of junk” - Charley Lineweaver 2002
|
|
|
|
|
Thank you Jonas:
You're right, the variable is a local one and it's destroyed. I didn't realize before because these functions are adaptations of a previous one in which the returned variable was a member variable. Thus the m_string.c_str() was not destroyed after exiting.
Sometimes, trees don't let you see the forest .... that's what happened this time.
My solution finally has been adding a member variable that is the one returned.
<br />
m_sText.clear();<br />
m_sText.append(s);<br />
return m_sText.c_str(); <br />
<br />
|
|
|
|
|
Hello!
I have a structure that contains several informations. This structure can be read directly from a file. In this file I have a "memory copy" of the structure, so I just have to make a fread (with the adress of the structure as first parameter) to import the complete structure. For compatibility, I NEED (!!) to have this structure with a packing alignment of 1 byte:
#pragma pack(1)
struct SOMESTRUCT
{
....
char data[];
}
#pragma pack() //restore to original byte alignment setting
This works fine when I read the structure in the file.
The problem occurs when I try to "put" data in the data field:
SOMESTRUCT* temp = .....;
int SomeValue = 3;
*((int*)temp->data)=SomeValue;
This works fine on the emulator but not on the remote device !!
So, I really don't know what to do!!
Thanks for help !
|
|
|
|
|
cedric moonen wrote:
This works fine on the emulator but not on the remote device !!
If I remember correctly, datatypes like int needs to be placed on even (or was it divisble by 4) memory addresses on Windows CE. Its unclear to me if your char data[] will be placed at an illegal address for an int, but that might be it.
A workaround would be using byte-wise copy, or perhaps re-order the struct.
Jonas
“Our solar system is Jupiter and a bunch of junk” - Charley Lineweaver 2002
|
|
|
|
|
Hi, thanks for suggestion.
I replaced *((int*)temp->data)=SomeValue; by a memcpy and the bug disapeared !! Thanks a lot
|
|
|
|
|
Hello, I try to open a file using FILE *fopen( const char *filename, const char *mode ); but the function returns NULL. The file exists and is in the same directory than my executable.
I tried with the emulator (the path is correct) and on the device and it doesn't work!
Is it possible that the "working directory" of the executable is not his own directory ???
Any idea?
Thanks
|
|
|
|
|
cedric moonen wrote:
FILE *fopen( const char *filename, const char *mode );
Oh, boy...
Windows CE means UNICODE! So, never ever forget to use the wide char versions of everything. Forget char , use TCHAR ! Also, fopen will NOT work, use _wfopen . Check the help file in order to find all wide character versions of the functions you would use on a desktop.
|
|
|
|
|
Hi !
Thanks for response.
First, fopen is supported. Taken directly from the MSDN help (from win CE !):
Remarks
The fopen function opens the file specified by filename. _wfopen is a wide-character version of fopen; the arguments to _wfopen are wide-character strings. _wfopen and fopen behave identically otherwise.
If I still want to use char* in winCE, that's because I want to import some of my desktop libraries (I cannot write everything again). So, if char is supported for some functions (like fopen), I won't change everything !
Second, the "solution" to the problem: I made some test (open a file in write mode so I can check where is the default directory). The error is what I supposed it is: the default directory is not the directory of the executable, it's the "main root". So, I have to specify complete path
Anyway, thanks for help !
PS: I think I will post some silly questions like that for a while 'cause it's the first time I work on a PocketPC and I worked a lot before on desktop version... !
|
|
|
|
|
cedric moonen wrote:
First, fopen is supported.
It is, but are you reading ANSI or UNICODE content? Are you specifying ANSI or UNICODE filenames and modes? When I moved to CE, I forgot about ANSI just to make my life less miserable, and it worked.
cedric moonen wrote:
So, I have to specify complete path
Yes, CE is a bitch.
Is it working, now?
|
|
|
|
|
João Paulo Figueira wrote:
Are you specifying ANSI or UNICODE filenames and modes?
I just open it for reading ("r") and that works fine. The contents are normal string that are stored in char*.
João Paulo Figueira wrote:
When I moved to CE, I forgot about ANSI just to make my life less miserable, and it worked.
Yep, but I cannot do that: I have a huge library that was developed on desktop environment and I want to reuse it (rewrite everything will take me really too much time) and I need to be compatible with the file format from my desktop computer (they need to understand each other). So, I have no choice: I will need to use ANSI string and convert them to UNICODE when they are not supported !
But I think I'll find a way out !
João Paulo Figueira wrote:
Is it working, now?
Yes, it is !
Anyway, thanks
|
|
|
|
|
cedric moonen wrote:
Is it possible that the "working directory" of the executable is not his own directory ???
Windows CE does not support 'working directories'. You will have to supply the full path to the file you wish to open. GetModuleFileName can be used to find the path to the exe.
Jonas
“Our solar system is Jupiter and a bunch of junk” - Charley Lineweaver 2002
|
|
|
|
|
Hi,
Ok thanks
|
|
|
|
|
hi,
i can be able to download/upload text files without any data loss.but i can't succeed when it is a binary file.
how can i resolve it ?
please guide me its urgent
thanks
siva
|
|
|
|
|
Hi,
I am not quite sure if this is the right place to put this but forgive me if it is not.
I have recently being toying with the idea of developing what i can quite inadequately only describe as a remote desktop. This will bear similarities with a citrix system on a network, except it will not primarily be on a network.
Imagine if you would a platform with a reliable internet connection, it need not have any applications installed apart from a client side application. This application allows it to embed within it any application for which it is licensed(an authorised client/subscriber) to use from a server running those applications.
Essentially it will be like having your c:\Program Files drive on a remote server. One would not necesarily need to have an application to use it. It may be possible to work around licensing by charging on a per thread/per single use basis.
Initial responses are that this domain is too vast for single developer implementation. As such it would be worthwhile identifying potential problem areas and contributing to those.
A totally simplistic, if at all realistic approach will be to use a common interface/ medium across all platforms ie www. and embed applications in typical applet style.
If there is any interest, critisism, contributions or any help on this and relating issues I would be most grateful for some feedback. I am considering this as a potential degree project.
Direct contact will also be welcome.
|
|
|
|
|
i am using embedded VC++3 for a project and needs to load more than 1000 records for user selection. the normal LB_ADDSTRING method per records is very slow. i saw LB_INITSTORAGE method. it seems a bit faster but since it allocates memory to it, there is no deallocation to it..so how to i deallocate memory from it after loading into listbox?
Actually the best way is read everything from the data and wcscat it to a temporary storage. after all records are read, then call the LB_ADDSTRING. this method is almost instand but i can't sort the records and also the records are not separated like if i use LB_ADDSTRING.
Any adviceS??? thanx.
|
|
|
|
|
Dear Friends,
Did any body know how to set bypass listt for the proxy for IE 5.5 on Windows CE .NET.
For ex i want set "*.abc.com" as bypass list for my IE 5.5 on Windows CE .NET.
Thanks and Best Regards,
Subbu,
2003/06/16 (13:31 JST).
|
|
|
|
|
Hi,
I have a image database in memory. When i want to display it on the screen, i use WinDrawBitmap. But this function does not allow me to resize my image. Is there anyway I can resize my images to show them as thumbnails?
Thanks.
|
|
|
|
|
Hi,
I am trying to port some .NET code to .NET CF. This code contains a lot of thread dependencies. Some threads must start and stop others or wait for them to be started or stopped. .NET has great support for thread synchronization but it is crippled in .NET CF. I can't use the Monitor.PulseAll() method or the Thread.IsAlive, .Abort or .Join methods. In the good old days of Win32 I could use WaitForSingleObject to wait for a thread that signals the mutex. This functionality is replaced by .join etc. but that is not available in the Compact Framework.
I know that I can implement the synchronization with AutoResetEvent and ManualResetEvent but than I have to use a variable that is checked by a thread to find out that another thread wants to stop it.
I really like the .NET thread synchronization mechanisms and I don't like to go back to the old-fashioned "polling" type of synchronization.
Who can point me to .NET CF specific multi threading info?
Regards, Gaston Rommens
|
|
|
|
|
Hi All,
How to hide start menu alone in win ce h/pc 2.11 ?
I can be able to hide the task bar and how to hide the start menu alone using Win CE API's.
The following code is used to hide the entire task bar.
Dim hwnd As Long
Dim lret As Long
hwnd = FindWindow("HHTaskBar", "")
lret = ShowWindow(hwnd, SW_SHOW)
'--- Code to set the form on top.
lret = SetForegroundWindow(Principal.hwnd)
lret = SetWindowPos(Principal.hwnd, HWND_TOPMOST, 0, 0, _
GetSystemMetrics(SM_CXSCREEN), GetSystemMetrics(SM_CYSCREEN), _
SWP_SHOWWINDOW)
please any one having any idea in this regard if so help me out
thanks,
siva
|
|
|
|
|
I'm developing a CE data entry program using eVC++ 3.0 with MFC. It uses a memory-mapped database. The database file can reside pretty much anywhere on the CE device, but I've been recommending that users (testers) keep it in non-volatile memory such as a CF card for data safety. Well that sure backfired!
Here's the problem: If the device (Pocket PC 2002 so far) is suspended then resumed while the program is running, all of the pointers to the database on the CF card seem to get scrambled, and point to garbage within the database. This does NOT happen if the database resides in the device's onboard memory, even after multiple suspend/restarts.
Anyone know what's going on with the CF card? Right now the only work-around I can think of is to detect when the device is being suspended, and clean up/close the database, then re-initialize everything when the device is resumed. However, I can't find how to detect either suspend or resume.
Aaaaaaaaaargh!
majoob
|
|
|
|
|
majoob wrote:
Right now the only work-around I can think of is to detect when the device is being suspended, and clean up/close the database, then re-initialize everything when the device is resumed. However, I can't find how to detect either suspend or resume.
I've had the similar problem with power off/on wrt the COM port. I used the following to fix the problem:
In my main exe I register a notification handler tied to NOTIFICATION_EVENT_WAKEUP that will be executed every time power is turned on:
<br />
CE_NOTIFICATION_TRIGGER nt;<br />
TCHAR szExeName[] = TEXT("\\windows\\XXXEventManager.exe");<br />
TCHAR szArgs[] = TEXT("-P");<br />
<br />
memset (&nt, 0, sizeof (CE_NOTIFICATION_TRIGGER));<br />
nt.dwSize = sizeof (CE_NOTIFICATION_TRIGGER);<br />
nt.dwType = CNT_EVENT;<br />
nt.dwEvent = NOTIFICATION_EVENT_WAKEUP;<br />
nt.lpszApplication = szExeName;<br />
nt.lpszArguments = szArgs;<br />
<br />
hNotificationHandle = CeSetUserNotificationEx (0, &nt, NULL);<br />
Then in XXXEventManager.exe I notify my com-port handler that it needs to reinit itself.
In my case, that was housed in a DLL that I could load and reinit, but I guess it could be handled in many ways, even w/o an extra exe-file.
Just remember to call CeRunAppAtEvent(PathToYourExe, NOTIFICATION_EVENT_NONE) somewhere when you dont need the notification anymore, otherwise you will never get rid of the notification w/o a hard reset.
majoob wrote:
Anyone know what's going on with the CF card?
I know too little about how the CF port get mapped/mounted to even try to answer that. =)
“Our solar system is Jupiter and a bunch of junk” - Charley Lineweaver 2002
|
|
|
|
|