Click here to Skip to main content
15,887,027 members
Home / Discussions / C#
   

C#

 
QuestionGraphics.MeasureString accuracy Pin
tasoss13-Jul-09 10:16
tasoss13-Jul-09 10:16 
AnswerRe: Graphics.MeasureString accuracy Pin
Christian Graus13-Jul-09 10:39
protectorChristian Graus13-Jul-09 10:39 
GeneralRe: Graphics.MeasureString accuracy Pin
tasoss13-Jul-09 10:47
tasoss13-Jul-09 10:47 
GeneralRe: Graphics.MeasureString accuracy Pin
Christian Graus13-Jul-09 10:58
protectorChristian Graus13-Jul-09 10:58 
GeneralRe: Graphics.MeasureString accuracy Pin
tasoss13-Jul-09 11:58
tasoss13-Jul-09 11:58 
AnswerRe: Graphics.MeasureString accuracy Pin
Luc Pattyn13-Jul-09 10:46
sitebuilderLuc Pattyn13-Jul-09 10:46 
QuestionAccessing a mapped drive in windows service Pin
mark_me13-Jul-09 9:48
mark_me13-Jul-09 9:48 
AnswerRe: Accessing a mapped drive in windows service [modified] Pin
Paladin200013-Jul-09 10:22
Paladin200013-Jul-09 10:22 
I recently created a simple service that moves files, but it may be similar enough to be useful. It uses a P/Invoke of mpr.dll to create a share without a drive letter; I did this because I ran into the same access denied errors that you mention above.

Don't know if this will help or not, but it worked for what I was doing. Good luck!

private const int RESOURCETYPE_DISK = 0x1;

[DllImport("mpr.dll")]
private static extern int WNetAddConnection2A(ref structNetResource pstNetRes, string psPassword, string psUsername, int piFlags);

[StructLayout(LayoutKind.Sequential)]
private struct structNetResource
{
    public int Scope;
    public int Type;
    public int DisplayType;
    public int Usage;
    public string LocalName;
    public string RemoteName;
    public string Comment;
    public string Provider;
}

/// <summary>
/// Transfers the specified file to the pre-defined Destination folder.
/// </summary>
/// <param name="AbsoluteFilename">The full path of the file to transfer.</param>
/// <param name="FileName">The name of the file, without the path.</param>
private void fileTransfer(string AbsoluteFilename, string FileName)
{
    try
    {
        //Define the directory mapping
        structNetResource stNetRes = new structNetResource();
        stNetRes.Scope = 2;
        stNetRes.Type = RESOURCETYPE_DISK;
        stNetRes.DisplayType = 3;
        stNetRes.Usage = 1;
        stNetRes.RemoteName = destinationFolder;  //Path to destination folder
        stNetRes.LocalName = string.Empty;  //This is the drive letter and colon (e.g., Q: )

        //Open the destination connection
        int i = WNetAddConnection2A(ref stNetRes, destinationPass, destinationUser, 0);
        if (i > 0) { throw new System.ComponentModel.Win32Exception(i); }

        //Move the file
        //  *** This is the line you would want to change ***
        if (File.Exists(AbsoluteFilename)) File.Move(AbsoluteFilename, destinationFolder + "\\" + FileName);
    }
    catch (Exception ex)
    {
        throw new System.Exception(ex.Message);
    }
}


modified on Monday, July 13, 2009 4:37 PM

GeneralRe: Accessing a mapped drive in windows service Pin
mark_me13-Jul-09 11:18
mark_me13-Jul-09 11:18 
GeneralRe: Accessing a mapped drive in windows service [modified] Pin
Paladin200014-Jul-09 9:10
Paladin200014-Jul-09 9:10 
AnswerRe: Accessing a mapped drive in windows service Pin
darkelv13-Jul-09 19:24
darkelv13-Jul-09 19:24 
GeneralRe: Accessing a mapped drive in windows service Pin
mark_me14-Jul-09 7:21
mark_me14-Jul-09 7:21 
QuestionOpenCV Project ? Pin
Mohammad Dayyan13-Jul-09 8:42
Mohammad Dayyan13-Jul-09 8:42 
AnswerRe: OpenCV Project ? Pin
Henry Minute13-Jul-09 8:46
Henry Minute13-Jul-09 8:46 
GeneralRe: OpenCV Project ? Pin
Mohammad Dayyan13-Jul-09 8:51
Mohammad Dayyan13-Jul-09 8:51 
GeneralRe: OpenCV Project ? Pin
Henry Minute13-Jul-09 9:01
Henry Minute13-Jul-09 9:01 
GeneralRe: OpenCV Project ? Pin
0x3c013-Jul-09 9:10
0x3c013-Jul-09 9:10 
AnswerRe: OpenCV Project ? Pin
Henry Minute13-Jul-09 9:20
Henry Minute13-Jul-09 9:20 
QuestionReading pdf file as text from the URL. Pin
aakar13-Jul-09 8:08
aakar13-Jul-09 8:08 
AnswerRe: Reading pdf file as text from the URL. Pin
Christian Graus13-Jul-09 8:25
protectorChristian Graus13-Jul-09 8:25 
Questiondecimal value being truncated when exporting data to excel from asp.net c# Pin
vijju0413-Jul-09 8:04
vijju0413-Jul-09 8:04 
AnswerRe: decimal value being truncated when exporting data to excel from asp.net c# Pin
Christian Graus13-Jul-09 8:26
protectorChristian Graus13-Jul-09 8:26 
AnswerRe: decimal value being truncated when exporting data to excel from asp.net c# Pin
paas13-Jul-09 8:33
paas13-Jul-09 8:33 
GeneralRe: decimal value being truncated when exporting data to excel from asp.net c# Pin
vijju0415-Jul-09 8:28
vijju0415-Jul-09 8:28 
AnswerRe: decimal value being truncated when exporting data to excel from asp.net c# Pin
PIEBALDconsult13-Jul-09 8:41
mvePIEBALDconsult13-Jul-09 8:41 

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.