Scripting a dll from JavaScript in PIE
Hi all!
I have read lots of posts about this subject.
But I would like somebody help.
I created a WCE MFC AppWizzard (dll) project and inserted a GetSerialNumber
function.
I compiled the project, exported the dll and registrered it.
Using vbscript, the code works fine. But when using javascript, I am
receiving the message "Automation server cannot create object".
vbscript code:
set objMsg = CreateObject("TesteCOM.TesteDLL") strMsg =
objMsg.GetSerialNumber()
javascript code:
var objMsg = new ActiveXObject("TesteCOM.TesteDLL"); var strMsg =
objMsg.GetSerialNumber();
Can anybody tell me what am I doing wrong? Why the code works fine in
vbscript but not in javascript?
Considering it is not a visible control, do I need to implement the
IObjectSafety interface?
If so, how should I do it?
Thank you,
Anderson Tag: PocketPC or Emulator at compile time? Tag: 68330
How to database?
Hi,
I am new with CE developing.
i discovered eVB and the emulator.
i also made a simple application.
now i would like to make a application to store stock/item information to a
table.
the info must be sent to a pc, where it will be processed in an interbase
database.
is it ok to use a access database?
if yes, how to start?
where is the component?
can someone show me a simple example project which works on the emulator? Tag: PocketPC or Emulator at compile time? Tag: 68325
eVC++ 4.0 cannot find Platform SDKs
This is really frustrating... I have eVC++ 3.0 installed and have been
using it without problems. When I've installed eVC++ 4.0 though, I can't
even launch it because I get the following error:
"Microsoft eMbedded Visual C++ has discovered no CE platform SDK installed
on the desktop. Please install at least one CE platform SDK before
launching Microsoft eMbedded Visual C++."
The trick is that I HAVE installed the SDK, and reinstalled, and uninstalled
and reinstalled, and nothing is getting past this...
I've installed the Pocket PC 2003 SDK, the CE.NET 4.0 SDK, the CE.NET 4.2
SDK, and the sample SDKs but I still get this error. I can't tell from
where VC++ 4.0 is enumerating it's list of installed SDKs; it doesn't appear
to be in the registry but I could be missing it.
Does anyone have any ideas on this one? I'd like to do both PPC2003 and
CE.NET 4.2 and can do neither because of this.
Thanks!
Timothy Tag: PocketPC or Emulator at compile time? Tag: 68324
Embed windows media player in V. Basic .NET
Hi all,
I'm writing an application in VB .Net for pocket pc 2002
(later
switch to 2003) and I have to embed windows media player
inside.
How can do it? I already tried to add WMP component in the
toolbox but it is not possible to use it (transparent
state, not really activated).
Is it possible to do it or I have to embed in the web page
instead of Vbasic application?
Do you any links with references and code source?
Thanks,
Juky Tag: PocketPC or Emulator at compile time? Tag: 68323
How to OPEN and SEEK .cdb using API?
Dear experts,
I cannot seek the DB after mounted and opened the DB, I
think it needed to set the sort order before seek but if
I set it, the DB cannot be opened, what's wrong in my
code?
Following is the extract of my code in eVC3.0:
//====================begin===============================
HANDLE g_hDB = 0; // Handle to database
CEOID g_oidDB = 0; // Object ID of the database
CEGUID g_guidDB; // Guid for database volume
DWORD dwIndex;
CEPROPVAL propSeek;
// Below is property for the sort order
const CEPROPID BookID = MAKELONG (CEVT_LPWSTR, 1);
// I can mount the .cdb successfully
CeMountDBVol(&g_guidDB, _T("\\test.cdb", OPEN_EXISTING);
// I can open the DB if no sort order
// but error to open if any sort order exist, why?
g_hDB = CeOpenDatabaseEx (&g_guidDB, &g_oidDB, _T("book"),
//BookID, //caused runtime error
if use "BookID", so I only can use the default '0' here:
0,
0, NULL);
//First seek to the start of the database, success for
offset value.
//The bookID in the first record should be "00001111"
CeSeekDatabase(g_hDB, CEDB_SEEK_BEGINNING, 0, &dwIndex);
//Seek the record with passed-in parameter
//search value below, just a sample and this record does
exist
propSeek.propid = BookID;
propSeek.val.lpwstr = _T("00005555");
//anyway, string value always cannot be seek, only offset
success
g_oidDB = CeSeekDatabase(g_hDB, CEDB_SEEK_VALUEGREATER,
(DWORD)&propSeek, &dwIndex);
//then read the record, it done well
CEOID ceoidRec;
DWORD dwBuf;
CEPROPVAL *props = NULL;
unsigned short lProps;
ceoidRec = CeReadRecordPropsEx(hDB, CEDB_ALLOWREALLOC,
&lProps, NULL,
(LPBYTE*)&props, &dwBuf, NULL);
//try to display the result
MessageBox (hWnd, props[0].val.lpwstr , _T("Message"),
MB_OK);
//======================end===============================
What do you think the result?
Right! it's "00001111", that means the first record,
haven't seek?
I created the access ".mdb" file with sample records,
field is "BookID" with index that must be unique,
from "00001111" to "00009999". And then I copy it to my
iPAQ3970 (I've also try with iPAQ3950 as well as the
emulator with same result), it converted to "test.cdb"
(without synchronization).
I have try the VOConnection and VORecordset, it can seek
by SQL but very slow where my real database have 30
thousand records and besides the speed, very strange that
some records in the middle cannot be seek and read,
(about the 15000'th to 20000'th records), I don't know
whether it's memory problem but my iPAQ still have very
much main memory spaces.
How can I use the sort order and seek my record in API?
Thousand thanks!
Nick. Tag: PocketPC or Emulator at compile time? Tag: 68313
SendKeys EVB
Dear friends,
I've a problem with SendKeys on EvB.
I want change of focus control with Enter Key.
I think make:
Private Sub Form_KeyPress(KeyAscii As Integer)
If KeyAscii = vbKeyReturn Then
SendKeys vbKeyTab
End If
End Sub
When I execute my program, it generate error:
"An error was encountered while running this program: Variable is Udefined:
'SendKeys'"
¿Anybody know how simulate push tab key?
Best Regards
Alamo. Tag: PocketPC or Emulator at compile time? Tag: 68311
Reading Serial Comm (GSP CF)
I am trying to read data from GPS CF using serial comm on Pocket PC 2002.
However, the result were some weird unreadable chars.
The GPS CF itself uses NMEA and I just follow its default settings.
Is there anyone can give some helps/support for me to solve this prob?
Thanks for any support/helps.
Peter Tag: PocketPC or Emulator at compile time? Tag: 68307
Loading images in WinCE
Hi,
I am developing an application which loads and shows big jpegs (like that of
3 to 4 MBs). Please anyone can give me some links or samples how to load and
show jpegs in win CE.
Thanks,
Arsalan. Tag: PocketPC or Emulator at compile time? Tag: 68301
Make button on commandbar unclickable
Hi
I have a commandbar and i want to show a bitmap on the commandbar when
a function is enabled.
The only way i know how to do this is to hide or show a button.
I do not want the button to become depressed when it is clicked on by
the user. IS there anyway to do this?
I do not want the button to be grayed, so making it disabled is ruled
out.
In the calendar program that comes with any pocket pc, when someone
clicks on date on the commandbar, it is not depressed, or clicked, or
however u wanna describe the button sinking down.
Is there anyway to replicate this behavior?
Thanks a lot for the help!!!
Regards,
Li Tag: PocketPC or Emulator at compile time? Tag: 68295
Access SQL Server2000 over WiFi : PlatformNotSupportedException
Help needed!!!
I have developed a smart device application using VS.net
2003. It runs good at Pocket PC 2002 emulator that I am
able to access the SQl server2000, but when I finished
deploying it on the target PDA, Toshiba e740, and run the
application from the PDA, I got an error
saying: "PlatformNotSupportedException" and I found that
error caused by the code line SqlClient SqlConnection
object OPEN method.
Any one has any idea about this problem? How can I fix
it? Please help! Thank you in advance.
Jesse Tag: PocketPC or Emulator at compile time? Tag: 68289
Targeting .Net CF
A few questions:
- I can create a new Smart Dev Application when I first create a project
from the New Project wizard, but how do I add CE as a build target later,
after I've created a "Windows Application"? The configuration manager
doesn't seem to let me do this. (E.g., I have a application that I want to
work in multiple environments -- desktop, CE, etc., it will resize, or
otherwise change behavior on the CE device.)
- What about class libs -- will they work on both platforms? (There's no
"Smart dev classlib" option -- but I thought there were APIs and
functionality not avail on all targets -- do I have to wait 'till runtime
before I get an error?)
thanks,
mike Tag: PocketPC or Emulator at compile time? Tag: 68285
ANN: NetPerceptor 2 Network Awareness Control for the Compact Framework
Hood Canal Systems is pleased to release v2.0 of its NetPerceptor
custom control for the .NET Compact Framework.
Give your applications the ability to detect and react to the presence of a
wireless network. Knowing whether a wireless network is up or down is an
essential requirement for handheld applications. Now you can add logic to
your program that allows it to act differently depending if it's in online
or offline mode. Once you start NetPerceptor, it runs in the background on a
separate thread where it fires events to notify your application about
network status. With full Visual Studio .NET designer support, this .NET
Compact Framework custom control makes it easy to build powerful wireless
applications using either C# or Visual Basic .NET. NetPerceptor Personal
Edition works with an Internet or Intranet resource to keep your application
aware of the current network status. New features of version 2.0 include the
ability to work with Basic Authentication, to react to invalid IP addresses,
and to provide the local IP address and device name of your Pocket PC. This
control can be redistributed royalty-free when embedded in your application.
Buy it now from Handango for just $14.95
http://www.handango.com/PlatformProductDetail.jsp?productType=2&optionId=1_2_2&jid=3EBEX7BA5F961A95F73E3721FAX15FCD&platformId=2&siteId=346&productId=78
215§ionId=0&catalog=30&txtSearch=hood Tag: PocketPC or Emulator at compile time? Tag: 68284
Some Pocket PC 2003 incorrectly running apps in "User mode"!
We discovered that some Pocket PC 2003 devices incorrectly run applications
in so-called "User mode", instead of "System mode".
This can cause multiple compatibility issues with Pocket PC applications
since there are things applications cannot do when running in "User mode".
For example they cannot execute the privileged instructions used to detect
the exact type of Xscale processor (e.g. PXA250/PXA255), and they also may
not be able to use some WIN32 API's.
From what we observe, we believe that the Pocket PC 2000-2002-2003 platforms
should always run applications in "System mode", but it looks like MSFT does
not provide a test to check that the Pocket PC 2003 platform builder is
properly configured, and MSFT did not warn device manufacturers about this
possible problem.
Most Pocket PC 2003 devices out there do run apps in "System mode", but some
don't.
We were able to catch the problem in a Pocket PC 2003 from Acer before it
hit the market, but apparently SYMBOL fell in the trap with their PPT8800...
So many applications will have compatibility problems on the SYMBOL PPT8800.
PocketTV Enterprise Edition is one of them :(
We will add a pop-up in PocketTV to warn of the problem when we detect it.
Comments from MSFT would be welcome... Tag: PocketPC or Emulator at compile time? Tag: 68280
How do I get the name of the Built-in Flash Directory on PPC2003
On Pocket PC/2000 the built in flash card name is under the registry entry
KEY_LOCAL_MACHINE\Drivers\Builtin\Flshdrv.
This entry does not seem to exist on PocketPC 2003. Does any know
how the get the built in flash card name on PPC 2003?
FindFirst/FindNextFlashCard()does not distingish bewteen "built in"
and removable flash cards. Tag: PocketPC or Emulator at compile time? Tag: 68277
BSTR to char[100]
I have a BSTR obtained from pocket outlook object model POOM get_FirstName
I want to copy the string into a char[100], how do i do that?
Thansk! Tag: PocketPC or Emulator at compile time? Tag: 68276
Want the API to turn off PPC device
Does anybody know the API to turn off PPC device?
Thanks in advance.
John Tag: PocketPC or Emulator at compile time? Tag: 68272
Easy setup for replication with SQL Server CE
Hi
I have this:
Pocket PC 3.011171
Windows XP Home Edition
Installed: Microsoft Visual Studio .NET 2003
Microsoft ActiveSync 3.5
Windows Server 2000
Installed: Microsoft SQL Server 2000
Microsoft SQL Server CE 2.0
IIS 5.0
The XP and the 2000 are in a LAN and the Pocket PC is linked to the XP
with usb to Active Sync 3.5. I want to know how to set up an easy, very easy
replication and start developing. I have not been able to find a good
tutorial, and I'm having some problems. My application gives me an error,
below is the code under a button click, the only code I have in the
application.
On the SQL 2000 I have made a publication of a simple DB, in IIS I have a
virtual directory containing the sscesa20.dll. Can anyone help me? Maybe
it's not possible to develop on my XP with the SQL Server CE 2.0 on the
Windows 2000 machine?
Tim
The Code:
Dim rep As SqlServerCe.SqlCeReplication
rep = New SqlServerCe.SqlCeReplication
rep.InternetUrl = "http://1.50.105.75/testSQLCE/sscesa20.dll"
rep.InternetLogin = ""
rep.InternetPassword = ""
rep.Publisher = "BALDER"
rep.PublisherDatabase = "ContactManagement"
rep.PublisherLogin = "sa"
rep.PublisherPassword = ""
rep.Publication = "ConatctManagement"
rep.Subscriber = "test"
rep.SubscriberConnectionString =
"Provider=Microsoft.SQLSERVER.OLEDB.CE.2.0;Data Source=\My
Documents\DatamanRep.sdf"
rep.AddSubscription(SqlServerCe.AddOption.CreateDatabase)
rep.Synchronize() Tag: PocketPC or Emulator at compile time? Tag: 68271
Programming on Pocket PC
Have a HP pocket PC with Windows CE (2000). When I
transfer my excel worksheet from my desktop computer to my
pocket I lose information such as forms, macros ect. I
would like to make a simple program using excel or visual
basics. Not sure what I need to make these compatible
with my pocket PC...plug-ins....downloads...I'm not sure.
Can anyone help?
. Tag: PocketPC or Emulator at compile time? Tag: 68270
oops - PocketPC 2003, Toshiba
I've been using an iPaq 3800 & 3900 devices and the code below works just
fine. But on a Toshiba with PPC 2003 runtime files everytime I execute this
code it starts a new instance of the program instead of reactivating the
current instance in memory. Therefore I get several instances of the same
program running at the same time. Can anyone help????
Public Declare Function CreateProcess Lib "Coredll" Alias "CreateProcessW" _
(ByVal pszImageName As String, ByVal pszCmdLine As String, ByVal
psaProcess As Long, _
ByVal psaThread As Long, ByVal fInheritHandles As Long, ByVal fdwCreate As
Long, _
ByVal pvEnvironment As Long, ByVal pszCurDir As Long, ByVal psiStartInfo
As Long, _
ByVal pProcInfo As String) As Long
lResult = CreateProcess("\Windows\pvbload.exe", "\Storage Card\Program_
Files\MobileLink\MobileLink4.vb", 0, 0, 0, 0, 0, 0, 0, "")
PS: I developing in evb until I master c# or vb.net
Thanks in advance,
steve Tag: PocketPC or Emulator at compile time? Tag: 68269
Quick database question.
Hi, I have an application developed with EVC4.0, using
OLE DB. I establish a connection/session to SQL Server CE
2. I find that if I for some reason get an SQL Query
error, I suddenly start getting the Unkown error 80004000
or something like that whenever I try anything else. Do I
have to somehow clear the error before I can do anything
else with the database?
Thanks. Tag: PocketPC or Emulator at compile time? Tag: 68268
PocketPc 2003, Toshiba
I've been using an iPaq 3800 & 3900 devices and the code below works just
fine. But on a Toshiba with PPC 2003 runtime files everytime I execute this
code it starts a new instance of the program instead of reactivating the
current instance in memory. Therefore I get several instances of the same
program running at the same time. Can anyone help????
Public Declare Function CreateProcess Lib "Coredll" Alias "CreateProcessW" _
(ByVal pszImageName As String, ByVal pszCmdLine As String, ByVal
psaProcess As Long, _
ByVal psaThread As Long, ByVal fInheritHandles As Long, ByVal fdwCreate As
Long, _
ByVal pvEnvironment As Long, ByVal pszCurDir As Long, ByVal psiStartInfo
As Long, _
ByVal pProcInfo As String) As Long
lResult = CreateProcess("\Windows\pvbload.exe", "\Storage Card\Program_
Files\MobileLink\MobileLink4.vb", 0, 0, 0, 0, 0, 0, 0, "")
Thanks in advance,
steve Tag: PocketPC or Emulator at compile time? Tag: 68267
store location for My Text in email for PPC 2003
This is a multi-part message in MIME format.
------=_NextPart_000_0008_01C3A78A.45C798E0
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
Text for My Text menu in Email dialog box used to come from =
[HKEY_CURRENT_USER\Software\Microsoft\MessengerService\PreSetMsgs] in =
Pocket Pc 2002. There used to be 0-9 entries for text that is displayed =
as MY Text menu items.
Now in Pocket PC 2003 they are not defined in that location but in a =
different location
[HKEY_CURRENT_USER\Software\Microsoft\Inbox\PresetMsgs]
the probelm I have is that in Pocket PC 2002 they were 10 already pre =
defined and user could change them
In Pocket PC 2003 they are either hardcoded or reading from some sort of =
database and if user mdofies then they are palced in =
[HKEY_CURRENT_USER\Software\Microsoft\MessengerService\PreSetMsgs] .
Does any one know where the original 9 message strings are kept for =
Pocket PC 2003??
------=_NextPart_000_0008_01C3A78A.45C798E0
Content-Type: text/html;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=3DContent-Type content=3D"text/html; =
charset=3Diso-8859-1">
<META content=3D"MSHTML 6.00.2800.1141" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY>
<DIV><FONT face=3DArial size=3D2>Text for My Text menu in Email =
dialog box=20
used to come from=20
[HKEY_CURRENT_USER\Software\Microsoft\MessengerService\PreSetMsgs] in =
Pocket Pc=20
2002. There used to be 0-9 entries for text that is displayed as MY Text =
menu=20
items.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>Now in Pocket PC 2003 they are not =
defined in that=20
location but in a different location</FONT></DIV>
<DIV><FONT face=3DArial=20
size=3D2>[HKEY_CURRENT_USER\Software\Microsoft\Inbox\PresetMsgs]</FONT></=
DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>the probelm I have is that in Pocket PC =
2002 they=20
were 10 already pre defined and user could change them</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>In Pocket PC 2003 they are either =
hardcoded or=20
reading from some sort of database and if user mdofies then they are =
palced in=20
[HKEY_CURRENT_USER\Software\Microsoft\MessengerService\PreSetMsgs]=20
.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2><STRONG>Does any one know where the =
original 9=20
message strings are kept for Pocket PC=20
2003??</STRONG></FONT></DIV></BODY></HTML>
------=_NextPart_000_0008_01C3A78A.45C798E0-- Tag: PocketPC or Emulator at compile time? Tag: 68261
using adoce in ecv3.0
Hi,
I am trying to use adoce31 in EVC++ 3.0, but when I make
the #import of the "adoce31.dll" I get several errors in
the files adoce31.tlh and adoce31.tli?? Does anyone know
what can this be, or have an example in EVC++ to use an
SQLSERVERCE db with ADOCE?
thanks
Luis Lima Tag: PocketPC or Emulator at compile time? Tag: 68260
C# - Last insert ID - SqlCeConnection
Howdy,
Iam trying to get the last insert id, i have tried "SELECT get_insert_id()"
but this wat not the solution, does anyone have a idea??
Greetings
Paul Govers Tag: PocketPC or Emulator at compile time? Tag: 68258
about eVC++4.0
SGkNCkNhbiBJIHdvcmsgd2l0aCBlVkMrKyA0LjAgaWYgSSBpbnN0YWxsIENvbXBhY3QgIE5ldCBG
cmFtZXdvcmsgb24gbXkgb2xkIFBvY2tldDIwMDI/ Tag: PocketPC or Emulator at compile time? Tag: 68254
FindWindow
FindWindow in CE does not support asterisk (*) as wildcard in search name,
anyone knows an alternative? Tag: PocketPC or Emulator at compile time? Tag: 68249
Question on compatiablity between WIN CE 3 and WIN CE .NET
If I first write a program for pocket PC 2002,
then is it supposed to be runnable without problem in the WIN CE .NET
environement?
Thanks,
--
.. Tag: PocketPC or Emulator at compile time? Tag: 68247
Problem in running emulator of embedded VC++ 3
I have successfully installed the embedded VC++ 3 in WINXP and WIN2003
But when i try to run the default "hello world" project,
the VC++ 3 try running in emulator..
but when the emulator starts to load,
it will automatically restart at each time, on both WINXP and WIN2003
Could someone help me?
Thanks, Tag: PocketPC or Emulator at compile time? Tag: 68246
Text overlaying a Bitmap
Has any member had experience of overlaying text over a bitmap using MFC?
I have tried using a Bitmap control, then using the OnPaint() method to
draw the text over the bitmap. But this doesn't work, the text doesn't
appear if the Bitmap is visible, although perfectly if hidden.
I have also tried using the OnPaint() to load the bitmap, display it,
and then write over it. This works perfectly, but there is an
uncomfortable flash as the white back screen is displayed before the
bitmap is overladed.
And I have tried both together, which does not disply the text.
I really need a method of using the Bitmap control, then writing over
the top of it, but I can't find the correct method.
If anybody knows a better method, I would be very interested in knowing.
Thanks in advance,
Ben Tag: PocketPC or Emulator at compile time? Tag: 68245
Text overlaying a Bitmap
Has any member had experience of overlaying text over a bitmap using MFC?
I have tried using a Bitmap control, then using the OnPaint() method to
draw the text over the bitmap. But this doesn't work, the text doesn't
appear if the Bitmap is visible, although perfectly if hidden.
I have also tried using the OnPaint() to load the bitmap, display it,
and then write over it. This works perfectly, but there is an
uncomfortable flash as the white back screen is displayed before the
bitmap is overladed.
And I have tried both together, which does not disply the text.
I really need a method of using the Bitmap control, then writing over
the top of it, but I can't find the correct method.
If anybody knows a better method, I would be very interested in knowing.
Thanks in advance,
Ben Tag: PocketPC or Emulator at compile time? Tag: 68244
ANN: OpenNETCF.Desktop.Communication 2.0 Released
Good news! OpenNetCF.org has released v2.0 of the
OpenNETCF.Desktop.Communication Library.
The Desktop.Communication Library contains classes used for communicating
with a CE device from a PC such as Microsoft's Remote API (RAPI).
We made some major changes to the library, adding a number events for
getting the current state of ActiveSync and the connected device. Now you
can detect when a device is connected, disconnected or syncing as well as
easily get the IP address of the connected device.
Get the source and binaries here:
http://www.opennetcf.org/communication.asp
A sample is available here:
http://www.opennetcf.org/samples.asp
All OpenNETCF.org libraries are covered by the OpenNETCF Shared Source
License. For more information visit:
http://www.opennetcf.org/License.asp
--
Chris Tacke, eMVP
Advisory Board Member
www.OpenNETCF.org
---
Windows CE Product Manager
Applied Data Systems
www.applieddata.net Tag: PocketPC or Emulator at compile time? Tag: 68240
Device Emulator 4.1 to 4.2
Hi there,
I recently installed the device emulator 4.2 but still Visual Basic .NET
(2003) connects to the 4.1 emulator.
How can I modify this setting? I looked through the configuration but
couldn't find the needed settings ...
Thank you in advance!
Sascha Tag: PocketPC or Emulator at compile time? Tag: 68238
Directory Identifiers in INF-File
I am currently writing my cab-file for the program installation.
I cannot find a directory ID for the Flash Card. Is there something
not documented? I am looking for an additional %CEn% ID.
Thanks.
Mike Tag: PocketPC or Emulator at compile time? Tag: 68232
RotateFlip
Hi,
I am trying to rotate a picture 90 degrees in a PictureBox. The
problem i have is that it seems all functionality to do so in .NET CF
has beenleft out. There is still GetPixel/SetPixel but it takes over 1
minute for a 640*480 picture.
I tried using the API but it is not working even though it is not
crashing.
Under Win2k, this piece of code should be working according to some
information found on internet. But is doesn't even though it doesn't
crash.
I suppose there is something i don't understand regarding bitmaps. Any
knows about it? I also tried some things with VB6. Still the same
result. The programs runs well but the picture stays unchanged.
Thanks for any help
====================================
<DllImport("kernel32.dll", EntryPoint:="LocalAlloc")> _
Private Shared Function LocalAlloc(ByVal uFlags As Integer, ByVal
uBytes As Integer) As IntPtr
End Function
<DllImport("kernel32.dll", EntryPoint:="LocalFree")> _
Private Shared Function LocalFree(ByVal hMem As IntPtr) As IntPtr
End Function
<DllImport("gdi32.dll", EntryPoint:="DeleteObject")> _
Private Shared Function DeleteObject(ByVal hObject As IntPtr) As
IntPtr
End Function
<DllImport("gdi32.dll", EntryPoint:="CreateBitmapIndirect")> _
Public Shared Function CreateBitmapIndirect(ByRef lpBitmap As
MYBITMAP) As IntPtr
End Function
<DllImport("gdi32.dll", EntryPoint:="GetObject")> _
Public Shared Function GetObject(ByVal hBitmap As IntPtr, ByVal
nSize As Int32, ByRef myBmp As MYBITMAP) As Int32
End Function
Public Structure MYBITMAP
Public bmType As Integer
Public bmWidth As Integer
Public bmHeight As Integer
Public bmWidthBytes As Integer
Public bmPlanes As Int16
Public bmBitsPixel As Int16
Public bmBits As IntPtr
End Structure
...
Dim bm_in As New Bitmap(PictureBox1.Image)
Dim hBitmap As IntPtr = bm_in.GetHbitmap()
GetObject(hBitmap, Marshal.SizeOf(bitmap), bitmap)
Dim pBytes(bitmap.bmHeight)() As Byte
Dim iCnt As Integer
For iCnt = 0 To bitmap.bmHeight - 1
ReDim pBytes(iCnt)(bitmap.bmWidthBytes - 1)
Marshal.Copy(bitmap.bmBits, pBytes(iCnt), iCnt * _
bitmap.bmWidthBytes, bitmap.bmWidthBytes)
Next
' ...... Code to flip the picture. Altering the byte array
hMem = LocalAlloc(LPTR, bitmap.bmWidthBytes * bitmap.bmHeight)
For iCnt = 0 To bitmap.bmHeight - 1
Marshal.Copy(New _
IntPtr(hMem.ToInt32()+iCnt*bitmap.bmWidthBytes),pBytes(iCnt), _
bitmap.bmWidthBytes)
Next
Dim newbitmap as MYBITMAP
With newbitmap
iBytes = bitmap.bmWidthBytes / bitmap.bmWidth
iHeight = 500
.bmHeight = bitmap.bmWidth
.bmWidth = iHeight
.bmWidthBytes = bitmap.bmWidth * iBytes
.bmType = bitmap.bmType
.bmBitsPerPixel = bitmap.bmBitsPerPixel
.bmPLanes = bitmap.bmPlanes
.bmBits = hMem
End With
hBitmap = CreateBitmapIndirect(newbitmap)
PictureBox1.Image = Image.FromHBitmap(hBitmap)
LocalFree(hMem)
DeleteObject(hBitmap) Tag: PocketPC or Emulator at compile time? Tag: 68231