Click here to Skip to main content
15,888,610 members
Home / Discussions / C#
   

C#

 
QuestionHow to get Windows explorer’s position using C#? Pin
srikrishnathanthri15-Aug-16 22:10
srikrishnathanthri15-Aug-16 22:10 
AnswerRe: How to get Windows explorer’s position using C#? Pin
OriginalGriff15-Aug-16 22:27
mveOriginalGriff15-Aug-16 22:27 
GeneralRe: How to get Windows explorer’s position using C#? Pin
srikrishnathanthri15-Aug-16 23:00
srikrishnathanthri15-Aug-16 23:00 
AnswerRe: How to get Windows explorer’s position using C#? Pin
Richard Deeming16-Aug-16 2:06
mveRichard Deeming16-Aug-16 2:06 
QuestionAutocomplete with any character in TextBox C# Pin
ThabetMicrosoft14-Aug-16 23:21
ThabetMicrosoft14-Aug-16 23:21 
AnswerRe: Autocomplete with any character in TextBox C# Pin
Pete O'Hanlon14-Aug-16 23:23
mvePete O'Hanlon14-Aug-16 23:23 
GeneralRe: Autocomplete with any character in TextBox C# Pin
ThabetMicrosoft14-Aug-16 23:35
ThabetMicrosoft14-Aug-16 23:35 
GeneralRe: Autocomplete with any character in TextBox C# Pin
Pete O'Hanlon14-Aug-16 23:38
mvePete O'Hanlon14-Aug-16 23:38 
Questionform java to c# Pin
Sikandar Javid14-Aug-16 19:52
Sikandar Javid14-Aug-16 19:52 
AnswerRe: form java to c# Pin
Simon_Whale15-Aug-16 0:34
Simon_Whale15-Aug-16 0:34 
QuestionAccounting software Pin
cupidanish14-Aug-16 17:25
cupidanish14-Aug-16 17:25 
AnswerRe: Accounting software Pin
Mycroft Holmes14-Aug-16 17:38
professionalMycroft Holmes14-Aug-16 17:38 
AnswerRe: Accounting software Pin
Richard MacCutchan14-Aug-16 21:17
mveRichard MacCutchan14-Aug-16 21:17 
AnswerRe: Accounting software Pin
Emmanuel Medina15-Aug-16 9:07
professionalEmmanuel Medina15-Aug-16 9:07 
QuestionFile comparison (byte, hash and meta) in C# Pin
Frank R. Haugen11-Aug-16 11:54
professionalFrank R. Haugen11-Aug-16 11:54 
AnswerRe: File comparison (byte, hash and meta) in C# Pin
Pete O'Hanlon11-Aug-16 22:05
mvePete O'Hanlon11-Aug-16 22:05 
AnswerRe: File comparison (byte, hash and meta) in C# Pin
Nathan Minier12-Aug-16 1:31
professionalNathan Minier12-Aug-16 1:31 
QuestionWindows Control Library Project in WinForms ... rant Pin
BillWoodruff11-Aug-16 1:13
professionalBillWoodruff11-Aug-16 1:13 
AnswerRe: Windows Control Library Project in WinForms ... rant Pin
Gerry Schmitz11-Aug-16 8:24
mveGerry Schmitz11-Aug-16 8:24 
Questionevent for partial view unload Pin
Raghavendra.Kodimala10-Aug-16 21:12
professionalRaghavendra.Kodimala10-Aug-16 21:12 
AnswerRe: event for partial view unload Pin
Pete O'Hanlon10-Aug-16 21:54
mvePete O'Hanlon10-Aug-16 21:54 
QuestionHaar-feature Object Detection in C# Pin
bird1235810-Aug-16 8:04
bird1235810-Aug-16 8:04 
AnswerRe: Haar-feature Object Detection in C# Pin
Richard Deeming10-Aug-16 8:06
mveRichard Deeming10-Aug-16 8:06 
AnswerRe: Haar-feature Object Detection in C# Pin
Afzaal Ahmad Zeeshan10-Aug-16 8:43
professionalAfzaal Ahmad Zeeshan10-Aug-16 8:43 
QuestionDll strange behavior C # Pin
equelna10-Aug-16 0:42
equelna10-Aug-16 0:42 
I have wrote a simple library, in C# (visual studio 2010), to access ini files for different applications.
The code at the end.

When used in windows application wrote in C# (x86,x64) (visual studio 2010) function properly.

Now I want to use it in a new library (mylib)(x64) where all methods are declared static, running indicates no errors but does not report the values that should have read from ini file.

I tried to add to the new library (mylib)a standard class, where methods aren't static, thinking that the problem was linked to the declaration of the static method of "mylib.getinipara()" , but without results.

Where am I wrong;
Thanks

ps.: all library and programs are compliled using Visual Studio 2010 Ultimate.

This is the code of library for accessing ini files.

C#
using System;
using System.Runtime.InteropServices;
using System.Text;

namespace FileINIAccess
{
    public class IniAccess
    {
        public string path;

        [DllImport("kernel32")] private static extern bool WritePrivateProfileSection(string lpAppName, string lpString, string lpFileName);
        [DllImport("kernel32")] private static extern bool WritePrivateProfileString(string section, string key, string val, string filePath);
        [DllImport("kernel32")] private static extern int GetPrivateProfileString(string section, string key, string def, StringBuilder retVal, int size, string filePath);
        [DllImport("kernel32")] private static extern int GetPrivateProfileSection (string lpAppName , StringBuilder lpReturnedString, int nSize , string lpFileName );

        public void IniFile(string INIPath)
        {
            path=INIPath;
        }

        public Boolean WriteProfileString(string Section, string Key, string Value)
        {
            bool rs=WritePrivateProfileString(Section,Key,Value,path);
            return rs;
        }

        public Boolean WritePrivatSection(string Section, string Value)
        {
            bool rs=WritePrivateProfileSection(Section,Value,path);
            return rs;
        }

        public string GetProfileString(string Section, string Key, string DefValue)
        {
            StringBuilder temp=new StringBuilder(255);
            int rs=GetPrivateProfileString(Section,Key,DefValue,temp,255,path);
            if (rs>0)
            {
                return temp.ToString();

            }
            else 
            {
                return DefValue.ToString();
            }
        }

        public string GetProfileSection(string Section)
        {
            StringBuilder temp=new StringBuilder(255);
            int rs = GetPrivateProfileSection(Section, temp, 255, path);
            if (rs>0)
            {
                return temp.ToString();
            }
            else 
            {
                return "";
            }
        }
    }

}

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.