[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

Problems calling a Windows API

Posted on 1998-08-24
3
Medium Priority
?
148 Views
Last Modified: 2010-04-04
Hi.... I'm trying to call a Windows API this way:

WritePrivateProfileString('Setup', 'Port', @S, 'Monitor.ini' );

where S is a string[1]. Obviously, this call is bad because it doesn't work. How can I do it to pass a string variable as parameter? If I use only S, compiler doesn't compile the code. Please Help!!!

Thanks in advance,
Jaime
0
Comment
Question by:skel
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 5

Accepted Solution

by:
ronit051397 earned 150 total points
ID: 1337606
You need to write:
WritePrivateProfileString('Setup', 'Port', pChar(S), 'Monitor.ini' );

See example on:
http://x12.dejanews.com/getdoc.xp?AN=322713398&CONTEXT=904027635.935591984&hitnum=14
0
 

Author Comment

by:skel
ID: 1337607
I looked at the example and I realized that I could use TIniFile component to access the Ini File. I used:

var ArchIni : TIniFile;

and then

ArchIni.Create( 'Monitor.ini' );
ArchIni.WriteString( 'Setup', 'Port', S );

When I run this code, compiler sends the warning:
'Variable ArchIni might not have been initialized'
and when I close the program, I got an exception Error on the application.
How can I solve it?

Thanks again in advance
Jaime

0
 
LVL 5

Expert Comment

by:ronit051397
ID: 1337608
ArchIni:=TiniFille.Create( 'Monitor.ini' );
ArchIni.WriteString( 'Setup', 'Port', S );
.

ArchIni.Free;
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
This course is ideal for IT System Administrators working with VMware vSphere and its associated products in their company infrastructure. This course teaches you how to install and maintain this virtualization technology to store data, prevent vuln…
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…
Suggested Courses

656 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question