Home » C# Programming

C# program to share screen using RDPCOMAPILIB.dll


i'm getting this error when i try to share screen from my notebook connected to the router using wifi n my pc by ethernet

"System.ArgumentException: Value does not fall within the expected range.

   at RDPCOMAPILib.IRDPSRAPIViewer.Connect(String bstrConnectionString, String bstrName, String bstrPassword)

   at AxRDPCOMAPILib.AxRDPViewer.Connect(String bstrConnectionString, String bstrName, String bstrPassword)"

this error comes each time i try to connect it

axRDPviewer.connect(Connstring,"user1", "");

I cant get this corrected...


It works perfect when i do it on my pc

but aint working when try to share my notebook screen...


the Connstring is being sent by Tcp message(Send and receive)...


Can u tell me where is the source of the problem... How can i take care of this???


4 Answers Found


Answer 1

Somebody Plz help me.. I cant find any kind of mistake... wats the error causing factor...

Answer 2


Here is a very helpful blog about this topic for your references, http://daron.yondem.com/PermaLink.aspx?guid=d8bbab27-169d-43d4-aea7-494845891789

Could you please make your scenario and the repro steps be more detailed?  Also, if you can provide us with some sample codes, it would be much helpful for us to troubleshoot the issue.

Have a nice weekend!



Answer 3

the code in the tutorial and that in my project is same... the difference is that the invitation message in the tutorial is being copied and then send to the viewer by user interaction. while in my project it is automated.. the invitation is sent to the viewer by tcp/ip message... the issue is not there when its done on the same pc.. i encounter this problem when i work on lan... when my host is on one system and viewer is on another system connected by LAN (Wifi/ethernet)... Do u still need the codes...


my project is in c#...


Thank u for the tutorial.... I guess i need some more help...

Thank u...



Answer 4

Hi Ayan,

I performed some tests at my lab.  Two Windows 7 systems, one for host and one for viewer.   The viewer is connecting by Wifi.   The share desktop apps work fine.   Could you please tell us what Windows version are you using on the host and viewer systems? 

BTW, when I copy/paste the connection string value from the host to the viewer, if we change the value even a single word, I can repro the error message : Value does not fall within the expected range.  So, could you please double check whether the connection string is the same between the host and the viewer? 

Good day!




Hi everybody,

I have a web site with a bunch of DLL in the bin directory. I have to use a newer version pf AjaxControlToolkit and I can't replace the old one.

So I create a virtual directory in the web site. I copy the new AjaxControlToolkit and the others DLL. But when I try to get the session variable (accessed normaly by the website DLL) I got nothing. It's correct because I'm isolated in a new application. But if I delete the virtual directory application, I will use the website bin, and the older AjaxControlToolkit too. Damned!

My need: Use a newer version of AjaxControlToolkit and get the same session (in a InProc mode) of the Web site.

At last, I can send information via URL and use a querystring fonction....But...

Best Regards

A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond...


When I connect to remote system for desktop sharing ....i got  this error.. but my program is working properly in LAN.. but i connect to external ip address .. i didnt connect..

Manually i forwaded the port in my system..(5000)..

so i connect from another system resides in the same network ,using external ip(port-5000)..

that time i got this error..


Regards ..




                Can any one help me out with screen sharing application with file transfer and chat application. I dont want the application to be a remote desktop application, it should be a desktop sharing application or a screen sharing application such that both the users could see the screen at the same time, you can share

the files as well as you can chat. I know that it could be done using virtual channel. Can anyone provide me with the code for it?

The application is present at this link for screen sharing



Now i want to send data as well as do file transfer

This is the interface used IRDPSRAPIVirtualChannel Interface and the method is SendData.

How to implement this interface?? Or can anyone provide me code for it??


Thanks & Regards,

Kiran Nakhale




I am new to C++ and i am using a book and i input the program and then build then run it but when i run it the program just flashes in dos for a sec. This is just a simple print to screen program but im having this issue and i would like to find out the problem before i continue any help would be appreciated. Thank you.

Hi. I am hoping someone can tell me what is wrong and what to change.

Using this link for how to


I added a splash screen to my program, using the default one and just changing some of the information on it like copyright etc and rezized the form a bit. I set it to to start centre screen. I am not sure if I did any other changes.

When it ran it came up with this error for the line I have added. I got it to copy the detail to clip board.

if I specify the splash screen as none again, my program runs so something must be wrong with it.

Any ideas what the problem is,



Here is the line that errors and the message.

        Version.Text = System.String.Format(Version.Text, My.Application.Info.Version.Major, My.Application.Info.Version.Minor)

System.FormatException was unhandled
  Message=Index (zero based) must be greater than or equal to zero and less than the size of the argument list.
       at System.Text.StringBuilder.AppendFormat(IFormatProvider provider, String format, Object[] args)
       at System.String.Format(IFormatProvider provider, String format, Object[] args)
       at System.String.Format(String format, Object arg0, Object arg1)
       at Work_Pricing_Program.SplashScreen1.SplashScreen1_Load(Object sender, EventArgs e) in M:\All Documents\Visual Studio 2010\Projects\Work Pricing Program\SplashScreen1.vb:line 29
       at System.Windows.Forms.Form.OnLoad(EventArgs e)
       at System.Windows.Forms.Form.OnCreateControl()
       at System.Windows.Forms.Control.CreateControl(Boolean fIgnoreVisible)
       at System.Windows.Forms.Control.CreateControl()
       at System.Windows.Forms.Control.WmShowWindow(Message& m)
       at System.Windows.Forms.Control.WndProc(Message& m)
       at System.Windows.Forms.ScrollableControl.WndProc(Message& m)
       at System.Windows.Forms.Form.WmShowWindow(Message& m)
       at System.Windows.Forms.Form.WndProc(Message& m)
       at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
       at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
       at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
       at System.Windows.Forms.SafeNativeMethods.ShowWindow(HandleRef hWnd, Int32 nCmdShow)
       at System.Windows.Forms.Control.SetVisibleCore(Boolean value)
       at System.Windows.Forms.Form.SetVisibleCore(Boolean value)
       at System.Windows.Forms.Control.set_Visible(Boolean value)
       at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
       at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
       at System.Windows.Forms.Application.Run(Form mainForm)
       at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.DisplaySplash()
       at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
       at System.Threading.ExecutionContext.runTryCode(Object userData)
       at System.Runtime.CompilerServices.RuntimeHelpers.ExecuteCodeWithGuaranteedCleanup(TryCode code, CleanupCode backoutCode, Object userData)
       at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
       at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean ignoreSyncCtx)
       at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
       at System.Threading.ThreadHelper.ThreadStart()



Hi ,


:Error 32000.The Commandline '"C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\12\Bin\Stsadm.exe.....returned non-zero value -1


Am getting this error while installing TFS 2008.


pls gimme some solution, i ve found other forunm with the same question but with 60\bin\Stsadm.exe  but mine is 12\bin\Stsadm.exe


I need to share and increment a counter accross several different instances of a program - written in c#. I used to use named shared memory in a previous life, but cant seem to figure out how its currently done in c#. Can anyone help with a snipet?

Thanks in advance,



I need to share and increment a counter accross several different instances of a program - written in c#. I used to use named shared memory in a previous life, but cant seem to figure out how its currently done in c#. Can anyone help with a snipet?

Thanks in advance,



hi everyone

this is my first post on MSDN social, so I hope I can be helpful here, I'm actually a 3d programmer (DirectX), but at the moment I'm working on a database application using C# (VS 2008), I've made a program which receives and sends SMS using GSM modem (an SMS gateway), it stores SMS data on a Database (MDF file) which I've created using ADD new data source (I think it is a wizard, it generates datasets and I use datates and datarows to access my DB), now I want to write another application for testing my program, I want this application to use my MDF file and write some records in this MDF file so that I can run both programs together, 2nd test application writes some records on the MDF file and meanwhile my main app checks its MDF, if there are any new records, it tries to send SMS. how can I do that? is it possible for a database to be read and written by more than one app at the same time?


please excuse me if my question comes in the wrong place, I've read the guidelines and FAQ but I couldn't find my answer as I'm almost new to Database, please help me

thanks in advance


Hello Room,

My SSIS package is running into a problem that I did not familiar whenever I executed or run the package.

The errors are:

[SSIS.Pipeline] Warning: Warning: Could not open global shared memory to communicate with performance DLL; data flow performance counters are not available.  To resolve, run this package as an administrator, or on the system's console.

Can someone help and advise please?




I'm new to shared memory dll and sharing data between processes.

My objective is as follows: I have to put images obtained from 3 different cameras in a shared memory location so that other application can access it (LabView).

I'm obtaining these images from a single exe using the camera API's provided by the manufacturer.

I have been successful in creating a shared memory dll and copying the image from one camera into it using the sample code given here   http://msdn.microsoft.com/en-us/library/ms686958%28VS.85%29.aspx and im able to read the image data in the target application.

My question is how do I specify a size for shared memory at runtime? since the image sizes would vary according to the resolution used I want to specify the size from the program that stored the data in shared memory.

Also i want to put the images obtained from 3 cameras in three distinct sections within the shared memory. how can this be achieved?

Apart from sharing data how is it possible to synchronize events between the two process e.g. if the target application wants to grab an image, how can it communicate with the camera application through shared dll.

I'm pretty new to a lot of concepts related to windows. I want to understand these well. Kindly guide me..




Hi all,

I'm developing an ETL package with various data flow tasks. All tasks use the same OLE DB connection manager. The simplest data flow task raises the warning mentioned in the subject.

The strange thing is that all the other data flow tasks do not raise the warning. I checked the web and found the following post: http://www.microsoft.com/communities/newsgroups/en-us/default.aspx?dg=microsoft.public.sqlserver.dts&tid=b24bfb73-e415-4325-8189-c389ed9afb32&cat=en_US_798c03b5-a957-4b37-9be9-2df16a439357&lang=en&cr=US&sloc=&p=1. Since I'm using OLE DB connection managers, sources and destinations.

Are there any component, container, other settings that could couse this warning? I find this very annoying since it's the only warning left in my package :)

Thanks for your help!


Kind regards,

Bob Stanneveld



I have a WPF solution comprised of only DLLs.  I have a module containing the following ResourceDictionary:

<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    <BitmapImage x:Key="FastForwardImage" UriSource="Icons/FastForward.png" />
    <BitmapImage x:Key="PauseImage" UriSource="Icons/Pause.png" />
    <BitmapImage x:Key="PlayImage" UriSource="Icons/Play.png" />
    <BitmapImage x:Key="RewindImage" UriSource="Icons/Rewind.png" />
    <BitmapImage x:Key="SaveClipImage" UriSource="Icons/SaveClip.png" />
    <BitmapImage x:Key="StopImage" UriSource="Icons/Stop.png" />

(The image files were added to the DLL project in which the above module resides with the "Resource" build action).

I want to use the images in both the project in which they reside and in another project (also a DLL).

My problem is that I get the "The resource "RewindImage" could not be resolved." warning for the XAML code:Snippet

<Image Source="{StaticResource ResourceKey=RewindImage}" />

The warning naturally repeats for all image resources.

When my solution contained an application and an app.xaml (in which I merged the resource module into Application.Resources), everything worked correctly.

Any idea (for both projects)?





I have a dll with one static int variable and a function that increments the variable. I have two apps, one is a console app that references this dll and calls the increment function. The second app is a windows form that does the same,  but also launches the console app as a process on button click. It appears that each app is talking to ts own copy of the dll in the memory thereby not producing the result I am looking for. Here is the code:


DLL Code:

namespace MyLib
    public class PrintNumber
        private static int count;
        public static void printNum(string from)
            Console.WriteLine("Called from: {0}", from);
            Console.WriteLine("Count is: {0}",count);

Console App Code:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using MyLib;

namespace ConoleTest
    class Program
        static void Main(string[] args)
            PrintNumber.printNum("Console App");

Windows Form Code:

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using MyLib;
using System.Diagnostics;
namespace RunConsoleTest
    public partial class Form1 : Form
        public Form1()
        private void Run_Click(object sender, EventArgs e)
            PrintNumber.printNum("Form before Console run");
            Process proc = new Process();
            proc.StartInfo.FileName = @"E:\C#\ConoleTest\ConoleTest\bin\Debug\ConoleTest.exe";
            PrintNumber.printNum("Form after Console run");


My expected result is for the integer variable to be incremented 3 times when I run the windows form app. But I can only see it getting incremented once when the console app has been launched.

Please help me understand what is going on and if I am doing something wrong here.




Hello! I have a big problem that I need to resolve.

I have one dll COM (VB6) within some classes.

I develop in Silverlight 3. I know that I can't reference dll COM in a SL3 project and so I Referenced this in Web Project.

I created a wcf silverlight-enabled, I've done an imoprts of my dll and I created a method that use some classes of my dll.

when I reference webservice in my silverlgiht application, I don't view classes.

Are there any workarounds?

thanks all!



I'm working on a bunch of solutions which uses a third party DLL from vendors like Telerik. We use the dll in most of your solutions. But when i uninstall any of the solutions the dll is getting removed from the assembly. This is a very unfortunate behavior.

I guess even putting the dll in the bin folder wont help it. Because i can use multiple solutions in a same web application. In that case if i remove on solution it is removing the dll from bin folder too.

What is the workaround for this ugly issue?

Thank you.

Visit SharePoint User group - India

I've updated VS 6 MFC app to VS 2005. I've can build sucessfully in 64 and 32 bit modes when I statically link the MFC libraries.

When trying to link to shared MFC files I get about 20 errors  of this type:

Error 63 error LNK2001: unresolved external symbol __CxxFrameHandler3 PropertyPageDebug.obj 

Error 75 error LNK2001: unresolved external symbol "const type_info::`vftable'" (??_7type_info@@6B@) mfcs80.lib 

Any suggestions.





On our development server the DDLS on C:\program files\Microsoft SQL Server\90\SDK\Assemblies are missing. example (microsoft.sqlserver.dtsruntimewrap.dll)

Can you pls advise what component in SQL server 2005 neds to be installed to have the ddls installed.



Hello everyone

       I build a DLL which is called by OS'DLL,I want to register this DLL with a application.I didn't want register it in registry.So I must register it in application?My platform is windows ce 6.0.who have some ideal?thanks


Hi all.

I have a solution with many projects. My question is... how do i get a final compiling result (Release) of my program with some of my solution projects dropping their compiled dlls into a specific folder (for example ../DLL or something) and not the root of the program?

I've tried changing many things in project properties, references, etc. but none of them worked or they made the code note compile.

Thanks in advance ^^


<< Previous      Next >>

Microsoft   |   Windows   |   Visual Studio   |   Sharepoint   |   Azure