Dear All,
I am stuck on these C++ data types const wchar_t * since last week.
It worked well in C# console application under mentioned below - unsafe static void Main(string[] args)
-
{
-
IntPtr ld, data1, data2;
-
string str = "test.txt";
-
int UTF_8 = 1;
-
-
// Using PInvoke
-
[System.Runtime.InteropServices.DllImportAttribute("Test.dll", EntryPoint = "LoadFromFile")]
-
public static extern System.IntPtr LoadFromFile(System.IntPtr aObj, System.IntPtr ex, [System.Runtime.InteropServices.InAttribute()] [System.Runtime.InteropServices.MarshalAsAttribute(System.Runtime.InteropServices.UnmanagedType.LPWStr)] string aPath, int aWritable);
-
-
[System.Runtime.InteropServices.DllImportAttribute("Test.dll", EntryPoint = "LoadFromFile_cset")]
-
public static extern System.IntPtr LoadFromFile_cset(System.IntPtr aObj, System.IntPtr ex, int aEncoding, [System.Runtime.InteropServices.InAttribute()] [System.Runtime.InteropServices.MarshalAsAttribute(System.Runtime.InteropServices.UnmanagedType.LPStr)] string aPath, int aWritable);
-
-
// data1 and data2 should have some address
-
// get some address in console application heredata1 = LoadFromFile(ld, IntPtr.Zero, str, 1);
-
data2 = LoadFromFile_cset(ld, IntPtr.Zero, UTF_8, str, 1);
-
-
// but I got can't get any address in C# Window Form
-
-
}
Here is origina C++ functions - struct Doc *API LoadFromFile (struct Loader * aObj, struct Exception * ex, const wchar_t * aPath, int aWritable)
-
-
struct Doc *API LoadFromFile_cset (struct Loader * aObj, struct Exception * ex, int aEncoding, const char * aPath, int aWritable)
So far I knew Marshalling or PInvoke used in anywhere console or window form, the result should be the same.
But very strange for this time since I am using other party libraries so I couldn't debug inside.
I hope some one will advise me since I need to close the case by tomorrow.
Thanks and best regards
0 1426 Sign in to post your reply or Sign up for a free account.
Similar topics |
by: Dutt |
last post by:
AMD x86/x64 and Multi Core using Visual Studio 2008
http://msdotnetsupport.blogspot.com/2008/01/amd-x86x64-multi-core-visual-studio.html
|
by: madasamonkey |
last post by:
I'm using Visual Studio 2008. The o/s is Win XP Pro.
Here's my problem:
The machine I'm working on is a PC and the monitor resolution is 1280 x 1024
The target machine on which the app will run is a media centre PC hooked up to a 42inch LCD display, on which the screen res is 1360 x 768.
I want the form to fill the entire TV screen, but my attempts to increase the form size to do this are thwarted by Visual Studio. Each time I try to set...
|
by: Colin J. Williams |
last post by:
The readme.txt has:
All you need to do is open the workspace
"pcbuild.sln" in Visual Studio,
select the desired combination of
configuration and platform and eventually
build the solution. Unless you are going
to debug a problem in the core or
you are going to create an optimized
build you want to select "Release" as
|
by: hocking |
last post by:
Hi,everyone !
I am using Emacs to edit source code ,i want to know how to compile
code by using visual studio 2008 in emacs.
|
by: Fakher Halim |
last post by:
Does someone know any place to get working examples of inherence implemented
in Entity Framework using Visual Studio 2008 SP1.
I could only implement just one table per hierarchy (
http://www.codeproject.com/KB/architecture/LinqEntityFramework.aspx)
--
Fakher Halim
| |
by: kilabyte |
last post by:
Hi,
First post on here, I can't see that the question has been asked before.
I am new to Visual Studio 2008 (using VB), but a seasoned programmer using Access and VBA.
I have created a web site in VS and a form that the user fills in on a web page. The results are written to a record on a server once the send button is clicked on.
10 items on the screen are validated (is a named entered, is an address entered, do money fields have a...
|
by: Ashish101 |
last post by:
Hi,
I am developing a Windows application and I want to add controls (Textbox,ComboBox etc) to the grid using visual studio 2008
As we use ItemTemplates in grid in Web Application , I am looking for same in Windows Application.
How would I do ???????
kindly help.
Thanks a lot
|
by: StrykerNet |
last post by:
My Crystal Report is pulling information from a stored procedure I wrote. So everytime I run my application it prompts me for a password for the server. How do I bypass this step and hardcode the password into my application. I don't want my users knowing the password for the server. I am writing in vb.net using visual studio 2008.
|
by: mfaisalwarraich |
last post by:
Hi Everybody,
I am new to VB.NET. I have googled around for the connection string to connect with Sql Compact edition database. but i really have no idea how to do that. furthermore i dont know how to connect a form's fields to that database. please give me a very simple example of doing this which can really clear the concepts. i will be very grateful to you.
thank you.
and please tell me if i wana use ms sql server 2005 and dotn wana...
|
by: Ewan |
last post by:
Hi
Im using Visual Studio 2008 and i have created a GridView which displays data from an SQL Table.
Could anyone help me on how could i export this data into an Excel sheet on click of a button.
Thanks
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
| |
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
|
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |