|
Shucks, this is a bit difficult to explain, but hopefully someone will understand.
I am developing an application that reads data from a serial port. The device that connects to the port is not available yet - fortunately I know the data stream format. I want to develop the application using a "virtual" COM port, meaning I'll have another application producing a data stream to the COM port in use by the application in development.
To perhaps explain it better, I want to develop two apps, one that produces a data stream to "COM1" and the real application to read from this COM1 port. After testing with various values from the "COM" port, I want to distribute this app without further development and must be able to read from a real COM port.
Please point me in the right direction.
Thanks
the confused are confused beyond confusion
|
|
|
|
|
A little off topic to begin with, but this board is designated to contain questions about COM where the abbreviation stands for the "Component Object Model" and not the serial communications port.
Just in case you had them mixed up.
Now to a suggestion for your question:
Develop a simulator for your device, but instead of a serial port you can use named pipes. Create the named pipe in your simulator with ::CreateNamedPipe() and then open it with ::CreateFile() in your application that is supposed to communicate with your future device.
You will be able to use the same API as when using a real serial port, but calls to ::SetCommState() and such will return FALSE . You will, however, be able to build the complete communication logic and the protocol and leave it unchanged when you open the real serial port instead of a named pipe.
I've used this technique several times in situations very similar to yours, which made it possible for me to develop client applications without the hardware.
"It's supposed to be hard, otherwise anybody could do it!" - selfquote "High speed never compensates for wrong direction!" - unknown
|
|
|
|
|
Hi,
i had creted Outlook addin in VS-2008, its working fine in my machine but when i try to install it in client machine, its giving the following error
Location: C\Program Files\Common Files\Microsoft shared\VSTO\8.0
Load Behaviour: Not Loaded. A runtime error occured during the loading of the COM Add-in
what are the Prerequisites reqitred for creating Outlook Setup.
Can any one please help me for installing in the client machine.
regards,
valli
srivalli.krothapalli
|
|
|
|
|
A DLL dependency issue maybe? You might want to verify that all the dependent DLLs that your add-in requires are present on the client's machine.
--
gleat
http://blogorama.nerdworks.in[ ^]
-- Number Two's eyes narrowed and became what are known in the Shouting and Killing People trade as cold slits, the idea presumably being to give your opponent the impression that you have lost your glasses or are having difficulty keeping awake. Why this is frightening is an, as yet, unresolved problem. -- HHGTG
|
|
|
|
|
Is the client machine running Windows 98/ME ?
|
|
|
|
|
Im working on a small project, mainly just a "can i do it".
I have a project in VB6, and i want to write a C++ ocx with managed code to call some C# functions, so basicly kind of like a wrapper.
While im sure i can pass data from vb6 to C#, i want to know how i can call functions in a VB6 class from c#
i was thinking that i might need to do something like this:
Pass Object from VB6 to c++ ocx file.
In C++, look at functions and make a list and send that to c#
When c# wants to run a function, it says to C++ to run X function.
C++ then runs that function in the class file.
Note that i havn't done anything remotly like this, and i don't even know exactly what exactly to ask for. Any tips would be nice
|
|
|
|
|
Matthew Cash wrote: I have a project in VB6, and i want to write a C++ ocx with managed code to call some C# functions, so basicly kind of like a wrapper.
Let me get this straight - you want to create a native OCX using managed C++ so you can call C# functions from a VB6 project? Whoa! That's kind of taking interop to the extreme isn't it?! Just kidding!
Seriously though, why are you proposing to have a C++ middle-man to liason between the VB6 component and the C# code? Can you not just create an ActiveX DLL using VB6 and use interop to invoke it from C#? And for invoking the C# code from VB6, use "TLBEXP" and "REGASM" to export the .NET class as a COM component.
Shouldn't you just be able to use .NET interop as the middle-man brokering calls?
--
gleat
http://blogorama.nerdworks.in[ ^]
-- Number Two's eyes narrowed and became what are known in the Shouting and Killing People trade as cold slits, the idea presumably being to give your opponent the impression that you have lost your glasses or are having difficulty keeping awake. Why this is frightening is an, as yet, unresolved problem. -- HHGTG
|
|
|
|
|
I did try something like that once, but for some reason, it never liked to work right.
all of the examples ive seen with .net COM stuff were for web pages, and didn't work well, or at all, for VB6
like i said, i don't really know what im doing, i was hopeing someone could guide me.
|
|
|
|
|
For an application running on two separate machines I use DCOM to communicate. On system 1 a CoClass exists, hosted in a COM server which acts as a singleton (using DECLARE_CLASSFACTORY_SINGLETON ATL). This CoClass is created from system 2 through DCOM, but also local by system 1.
Despite using the singleton classfactory still two instances of the CoClass exist in running server (one for all local system 1 clients, and one for all dcom clients). I've tried changing a number of security settings through DCOMCnfg but this didn't help (sometimes even ended up with two servers next to each other ).
Strange thing is that when the CoClass is first created through DCOM and later by the local user it all seems to work. The other way around however always creates two instances. Unfortunately both systems can be switched on or off seperately so the starting order isn't defined.
Current settings are:
Authentication Level - Connect
Impersonation Level - Identify
Identity - This user (same user as the local on system 1 also CoCreating the CoClass)
Both systems are using Windows XP SP2.
Anyone got any idea on why this doesn't work ( and hopefully knows how to solve ) ??
modified on Thursday, October 30, 2008 6:25 PM
|
|
|
|
|
Hello:
I'm not sure if this is the right posting area for this? I'm new to this sight and really green when it comes to command line. I'm a student and need help with a few questions. I have answered them but have questions on the last three. Forgive me if this is not the area to ask this.
I'm being asked to write five lines that would perform the following in a batch file.
1.Document the batch file explain that it is a demonstration file.
Rem Demonstration File
2. List the files in the A:\temp directory
dir A:\temp
3. Display the contents of a file in the a:\temp directory that is specfied when the batch file is called.
( This is were i have some questions)
Type %1 (is this correct?)
4. Rename the above file to name.new
without the ren is there another way of doing this?
5. Display the contents of the Name.New file.
Type Name.New (is this correct?)
Any help would be greatly appreciated !
|
|
|
|
|
Hi, all!
Help me please with ISpoolerHook. How to use it? Needs some examples... Thnks
|
|
|
|
|
Hi,
I have created a fully editable data using template columns for using it for data entry and editing.Can some one help to validate the data entered into the grid and also check for duplicates. I am reading all the data from the datagrid into a typed dataset for saving into database so essentially I need to check for duplicates in the dataset. My datagrid contains 2 columns and each column is a textbox to enter data.
Uday.
-UdayKiran
|
|
|
|
|
when i move a ocx control form my PC to a new computer, use "regsvr32 file.ocx", it show a error message of "loadlibrary("file.OCX")failure", but in my PC, it was working good not any failures.
can anyone help me to resolve this problem?
Thanks for you help.
|
|
|
|
|
Use Depends on the .ocx file to make sure that all of the dependencies are present on the target computer.
Why is common sense not common?
Never argue with an idiot. They will drag you down to their level where they are an expert.
Sometimes it takes a lot of work to be lazy
Individuality is fine, as long as we do it together - F. Burns
|
|
|
|
|
It seems all dependencies is right, look as follows:
ADVAPI32.DLL
COMCTL32.DLL
GDI32.DLL
GISQCONTROL.DLL
GISQSTYLEDIALOG.DLL
KERNEL32.DLL
MFC42D.DLL
MFCO42D.DLL
MSIMG32.DLL
MSVCRT.DLL
MSVCRTD.DLL
NTDLL.DLL
OLE32.DLL
OLEAUT32.DLL
RPCRT4.DLL
SECUR32.DLL
USER32.DLL
GISQCONTROL.DLL and GISQSTYLEDIALOG.DLL, it my compiled com dll. is there any another issues in this case.
|
|
|
|
|
Try profiling it through "dependency walker". Open "regsvr32.exe" in depends and select "Start Profiling..." from the "Profile" menu. Pass the path to the OCX in the "Program arguments" box and click "OK". See what DW reports in the messages box. You should get a clue or two.
--
gleat
http://blogorama.nerdworks.in[ ^]
-- Number Two's eyes narrowed and became what are known in the Shouting and Killing People trade as cold slits, the idea presumably being to give your opponent the impression that you have lost your glasses or are having difficulty keeping awake. Why this is frightening is an, as yet, unresolved problem. -- HHGTG
|
|
|
|
|
Hi,
Can anybody please give me some free links to learn the topics VB6, ASP and COM. I dont have much idea of it as I am .Net programmer but I want to learn them.
Thanks,
Aleem Mohammad.
Thanks & Regards,
Md. Abdul Aleem
NIIT technologies
|
|
|
|
|
I am getting this error while accessing the lotus notes. It is working fine when executes in my system but giving this error while executing in IIS virtual directory.
The error is
Retrieving the COM class factory for component with CLSID {29131539-2EED-1069-BF5D-00DD011186B7} failed due to the following error: 8007000e.
Source Error:
Line 22: protected void btnAddress_Click(object sender, EventArgs e)
Line 23: {
Line 24: Domino.NotesSessionClass sessclass = new Domino.NotesSessionClass();
Line 25: sessclass.Initialize("lotuspwd");//PWD is required
Line 26: Domino.NotesDatabase notesDB = sessclass.GetDatabase("serveraddress", "names.nsf", false);
Thanks for any help.......
Lakshmi
|
|
|
|
|
HRESULT 8007000e corresponds to E_OUTOFMEMORY.
For Notes/Domino specific queries Lotus Notes forum[^] might be a good place to ask.
Sohail
modified 21-Apr-21 21:01pm.
|
|
|
|
|
hi,
I am trying to autoformat an Excel (.xls) file and then import it into Sql server 2000 table using C# in Asp.net. But when i try to autoformat the excel file i get the exception "Attempted to read or write protected memory. This is often an indication that other memory is corrupt." Someone please help me to solve this problem
Here is the code.
sing System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Data.SqlClient;
using System.Data.OleDb;
using System.Data.Odbc;
using System.Text;
using Microsoft.Office.Interop.Excel;
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
SqlConnection Cn = new SqlConnection("server=143.14.45.137; database= NitDB; User ID=uy; Password= g");
SqlCommand Cm = new SqlCommand("Select * from ExcelFile", Cn);
Cn.Open();
SqlDataReader St = Cm.ExecuteReader();
gdExcelFile.DataSource = St;
gdExcelFile.DataBind();
St.Close();
Cn.Close();
}
public static void PrintProgressBar()
{
StringBuilder sb = new StringBuilder();
sb.Append("<div id='updiv' style='Font-weight:bold;font-size:11pt;Left:320px;COLOR:black;font-family:verdana;Position:absolute;Top:140px;Text-Align:center;'>");
sb.Append(" <script> var up_div=document.getElementById('updiv');up_div.innerText='';</script>");
sb.Append("<script language=javascript>");
sb.Append("var dts=0; var dtmax=10;");
sb.Append("function ShowWait(){var output;output='Reading data from excel...PLEASE WAIT!';dts++;if(dts>=dtmax)dts=1;");
sb.Append("for(var x=0;x < dts; x++){output+='';}up_div.innerText=output;up_div.style.color='red';}");
sb.Append("function StartShowWait(){up_div.style.visibility='visible';ShowWait();window.setInterval('ShowWait()',100);}");
sb.Append("StartShowWait();</script>");
HttpContext.Current.Response.Write(sb.ToString());
HttpContext.Current.Response.Flush();
}
public static void ClearProgressBar()
{
StringBuilder sbc = new StringBuilder();
sbc.Append("<script language='javascript'>");
sbc.Append("alert('Data exported successfully');");
sbc.Append("up_div.style.visibility='hidden';");
sbc.Append("history.go(-1)");
sbc.Append("</script>");
HttpContext.Current.Response.Write(sbc);
}
protected void btnExport_Click(object sender, EventArgs e)
{
PrintProgressBar();
{
OdbcConnection connection;
SqlBulkCopy bulkCopy;
string ConnectionString = @"server=178.17.44.137;database= NitDB; User ID= er; Password=d";
string connstr = @"Driver={Microsoft Excel Driver (*.xls)};DriverId=790;Dbq=" + fyle.Value;
using (connection = new OdbcConnection(connstr))
{
string[] temp;
string fn1;
fn1 = System.IO.Path.GetFileName(fyle.PostedFile.FileName); \\ fyle is the Html File upload control
temp = fn1.Split('.');
object missing = System.Reflection.Missing.Value;
Microsoft.Office.Interop.Excel.Application excel = default(Microsoft.Office.Interop.Excel.Application);
Microsoft.Office.Interop.Excel.Workbook wb = default(Microsoft.Office.Interop.Excel.Workbook);
excel = new Microsoft.Office.Interop.Excel.Application();
// I get the exception at the below statement.
wb = excel.Workbooks.Open(fn1, missing, missing, missing, missing, missing, missing, missing, missing, missing, missing, missing, missing, missing, missing);
excel.Visible = true;
//wb.Activate();
excel.Cells.Select();
excel.Columns.AutoFit();
excel.Rows.AutoFit();
OdbcCommand command = new OdbcCommand("Select * FROM [" + temp[0].ToString() + "$]", connection);
connection.Open();
using (OdbcDataReader dr = command.ExecuteReader())
{
using (bulkCopy = new SqlBulkCopy(ConnectionString))
{
bulkCopy.DestinationTableName = "ImportedExcel";
bulkCopy.WriteToServer(dr);
}
dr.Close();
}
}
bulkCopy.Close();
connection.Close();
}
ClearProgressBar();
}
}
Nitin Raj Bidkikar
|
|
|
|
|
Hi, All!
I need to develop hook for income/outgoing email messages using MAPI hooks. How can doing that? Some links or samples will be very good
|
|
|
|
|
Hello,
perhaps somebody can help me to find the reason for the crashes I have.
I have a MFC Application with MFC extension DLLs.
One of the dialogs is a window with a CPropertySheet.
One CPropertyPage is a host for ActiveX Controls providing extending UI.
This CPropertyPage has a CWnd member to host the ActiveX Controls dynamically created runtime using the CWnd::CreateControl method.
I have a VB ActiveX Control providing needed extending UI.
It can be loaded and used without problems.
The only problem occurs, when the application exits:
1. The CPropertySheet is destroyed ... the CPropertyPage is destroyed, ...
... which releases its previously queried interfaces,
... sends a WM_DESTROY to the CWnd hosting the ActiveX Control and
... deletes/frees the CWnd
2. Somewhere at the end just before invoking "exit" open "OLE" connections/loaded "OLE" libraries are terminated by Microsoft internal code. I saw that the ActiveX OCX module was active until this moment.
3. In the "exit" invocation the MFC application crashes from within the VB ActiveX Control. The VB ActiveX Control does not execute its UserControl_Terminate handler, so it seems, that there happens an irregular deletion of the VB ActiveX Control.
This crash happens currently only in the debug version of our application. But adding CommonControls to the VB ActiveX Control UI causes a crash even in the release version of this MFC application.
Using a MFC ActiveX Control providing some UI, too, no problems occur.
The only difference seen while releasing the last reference to the previously queried interface are that ...
... the release on the interface of VB ActiveX Control returns 4 still valid references,
... while the release on the interface of the MFC ActiveX Control returns only 3 still valid references.
Thus I suspect, that at application end there is still a last reference valid, not released, which causes a crash after the OCX is unloaded from Microsoft internal code cleaning up before the real application exit.
Something in the VB ActiveX Control wants still to work (like executing UserControl_Terminate), but the OCX is already unloaded.
But ... where and how can I find this last reference?
Debugging through the MFC code hosting the ActiveX Control didn't help really?
Has somebody here experienced a similar problem? Or can somebody help?
Thanks in advance,
Martin
|
|
|
|
|
Hi Martin,
I think you are on right track. Just make sure you are not holding any reference in your own code. Use smart pointer (CComPtr, CComQIPtr). If you queried for an interface, make sure you release it in your OnDestroy. I don't think it matters that you are using an MFC extension DLL, as long you release your interface, it should work fine.
Did you try creating a separate project (simple dialogbox) using the activeX in question?
In the end, we will remember not the words of our enemies, but the silence of our friends. - Martin Luther King Jr.
Ernest Laurentin
|
|
|
|
|
Hi Ernest,
thanks for your reply.
Until today morning I used no smart pointers, but using them does not change a thing.
I didn't expect a change in behaviour, because in my MFC C++ ActiveX control I could see, while debugging, that my reference handling was ok.
Ok - now I've introduced CComIQPtr and CComPtr, but it changes nothing.
The question is, why in comparison to the MFC ActiveX control one additional reference to the VB ActiveX control is hold!? And how/what is holding this reference to which interface?
The question raises, because releasing "my" interface I got a count of hold references of 3 with the MFC ActiveX control, but 4 with the VB ActiveX control.
And debugging through the deletion of my hosting CWnd I see only 3 releases on the interfaces of the MFC and the VB Active control.
So - where is the last reference on a interface to be found?
And ... do I have the possibility to change this behaviour?
Best regards,
Martin
|
|
|
|
|
Hello again,
first - I'm sorry, because I didn't provide any information about the development environment:
Microsoft Visual Studio 6.0 SP6
Microsoft Visual Basic 6.0 SP6
And ... no ... I can not upgrade - currently!
Second - I created a new most simple MFC application only loading the VB ActiveX control and raising an exception on exiting.
It has a CWnd* member on which CreateControl is called and which is deleted while deleting the dialog object.
So it shows the same behavior than the big MFC application I normally work on.
Has someone a hit or suggestion?
Best regards,
Martin
|
|
|
|
|