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

C#

 
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 "";
            }
        }
    }

}

AnswerRe: Dll strange behavior C # Pin
Richard MacCutchan10-Aug-16 1:59
mveRichard MacCutchan10-Aug-16 1:59 
GeneralRe: Dll strange behavior C # Pin
equelna10-Aug-16 4:43
equelna10-Aug-16 4:43 
GeneralRe: Dll strange behavior C # Pin
Richard MacCutchan10-Aug-16 4:50
mveRichard MacCutchan10-Aug-16 4:50 
GeneralRe: Dll strange behavior C # Pin
equelna10-Aug-16 5:01
equelna10-Aug-16 5:01 
GeneralRe: Dll strange behavior C # Pin
Richard MacCutchan10-Aug-16 5:03
mveRichard MacCutchan10-Aug-16 5:03 
GeneralRe: Dll strange behavior C # Pin
equelna10-Aug-16 5:11
equelna10-Aug-16 5:11 
GeneralRe: Dll strange behavior C # Pin
Richard MacCutchan10-Aug-16 5:13
mveRichard MacCutchan10-Aug-16 5:13 
GeneralRe: Dll strange behavior C # [SOLVED] Pin
equelna10-Aug-16 6:33
equelna10-Aug-16 6:33 
QuestionImplementing a Cue Banner to a textbox in windows xp with custom color Pin
srikrishnathanthri9-Aug-16 21:41
srikrishnathanthri9-Aug-16 21:41 
AnswerRe: Implementing a Cue Banner to a textbox in windows xp with custom color Pin
Richard MacCutchan9-Aug-16 22:11
mveRichard MacCutchan9-Aug-16 22:11 
QuestionHTML Tag Pin
Member 126768148-Aug-16 22:23
Member 126768148-Aug-16 22:23 
GeneralRe: HTML Tag Pin
Richard MacCutchan8-Aug-16 23:18
mveRichard MacCutchan8-Aug-16 23:18 
AnswerRe: HTML Tag Pin
Bernhard Hiller9-Aug-16 21:12
Bernhard Hiller9-Aug-16 21:12 
SuggestionRe: HTML Tag Pin
Richard Deeming10-Aug-16 1:21
mveRichard Deeming10-Aug-16 1:21 
QuestionGet Value of Datasource When Selected Item in ComboBox Pin
Mostafa_Hosseini8-Aug-16 5:40
Mostafa_Hosseini8-Aug-16 5:40 
AnswerRe: Get Value of Datasource When Selected Item in ComboBox Pin
OriginalGriff8-Aug-16 6:05
mveOriginalGriff8-Aug-16 6:05 
GeneralRe: Get Value of Datasource When Selected Item in ComboBox Pin
Mostafa_Hosseini8-Aug-16 6:18
Mostafa_Hosseini8-Aug-16 6:18 

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.