473,545 Members | 1,956 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

use GetPrivateProfi leString

Hi,
I am trying to use the function GetPrivateProfi leString as following:
[DllImport("kern el32.dll")]
public static extern Int32 GetPrivateProfi leString(string lpAppName, string
lpKeyName, string lpDefault, string lpReturnedStrin g, short nSize, string
lpFileName);

.......

String sDatabase = "";

Int32 lSize = GetPrivateProfi leString("MyApp ", "DataDataba se", "",
l_sDatabase, 255, "c:\\prj\\MyApp .ini");

lSize is now = 18, but l_sDatabase is still empty

How can I do?
How can I assign a string contained 255 char 0 to l_sDatabase?
Thanks

Nhan


Jul 30 '07 #1
2 3736
"Nhan" <le*****@freene t.dewrote in message
news:%2******** **********@TK2M SFTNGP03.phx.gb l...
How can I do?
http://www.pinvoke.net/default.aspx/...ileString.html
--
Mark Rae
ASP.NET MVP
http://www.markrae.net

Jul 30 '07 #2
Thanks
Nhan

"Mark Rae [MVP]" <ma**@markNOSPA Mrae.netwrote in message
news:uw******** ******@TK2MSFTN GP04.phx.gbl...
"Nhan" <le*****@freene t.dewrote in message
news:%2******** **********@TK2M SFTNGP03.phx.gb l...
>How can I do?

http://www.pinvoke.net/default.aspx/...ileString.html
--
Mark Rae
ASP.NET MVP
http://www.markrae.net

Jul 31 '07 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
19190
by: Mark Hayworth | last post by:
Randy: I too am having the problem that this other guy/girl had. I put in the proper API declarations and arguments for GetPrivateProfileString yet it doesn't return the correct stuff. It always returns the default value (padded with huge amount of spaces on the right) and the return value (number of characters read) is some crazy huge...
1
3930
by: Germic | last post by:
Does C# has an equivalent of the 'C' GetPrivateProfileString? or is the only way to get similar features to read from an INI file is to do a DllImport on Kernel32.dll? Thanks
5
19640
by: L | last post by:
static extern uint GetPrivateProfileString( string lpAppName, string lpKeyName, string lpDefault, StringBuilder lpReturnedString, uint nSize, string lpFileName); Interoping GetPrivateProfileString is giving me this Exception in
1
3632
by: Domac | last post by:
I need to read some configuration data from .ini file located at Application.StartupPath location . Here is code snippet : Public Declare Unicode Function GetPrivateProfileString Lib "kernel32" Alias "GetPrivateProfileStringW" (ByVal lpApplicationName As String, ByVal lpKeyName As String, ByVal lpDefault As String, ByVal...
5
7644
by: 海风 | last post by:
A question about GetPrivateProfileString a section in a .ini file , for example ip = 192.168.1.112 .... i want to get the ip value by using GetPrivateProfileString() function. the code is :
1
1663
by: thiago777 | last post by:
Is there a better way of accomplishing this ?: http://msdn2.microsoft.com/en-us/library/ms724353.aspx I have some program settings which should be easily editable by the user (really like in a text file), but dont want to use such an old function like GetPrivateProfileString.. maybe an XML file would be the best solution ? thanks
6
3784
by: alag20 | last post by:
Hi Guys, I need some urgent help with this as I am becoming clueless now. I have 2 DllImport as below from Kernel32 private static extern int GetPrivateProfileString(string section, int key, string defaultValue, byte result, int size, string fileName); private static extern int GetPrivateProfileString(string section, string key,...
0
7415
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...
0
7675
Oralloy
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. ...
0
7928
jinu1996
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...
0
4963
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3470
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3451
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1902
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1030
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
726
bsmnconsultancy
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...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.