Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
B

BubbaGeeNH

@BubbaGeeNH
About
Posts
12
Topics
9
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • Converting calloc to new.
    B BubbaGeeNH

    I'm trying to convert some old code that is using 'calloc' to use 'new' but I'm having a little trouble with this: void (**temp_stack)(void); temp_stack=(void (**)())calloc(count+1,sizeof(void *)); I tried using this: void (**temp_stack)(void); temp_stack=new (void*[count+1]); but get the following error: error C2440: '=' : cannot convert from 'void ** ' to 'void (__cdecl ** )(void)' Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast Can anyone help me figure it out? Thanks, George

    George

    C / C++ / MFC help question

  • Issue Reading and Writing to Serial Port
    B BubbaGeeNH

    If I run my class as part of a Console application I have no problems with it communicating correctly and getting the correct responses. My problem is when I try to run it as part of a Windows GUI application. It seems as though the compiler is making my application a multi-threaded application and it is putting the writing and reading of portions of the class into different threads.

    George

    Managed C++/CLI help csharp c++ visual-studio question

  • Issue Reading and Writing to Serial Port
    B BubbaGeeNH

    I've written a managed class that handles the serial communication to a laser using ascii text. My problem is if my GUI makes too many calls to the functions in the laser communication class I get the wrong responses back from the laser. They are valid responses but it appears as if the response from the first call is being replaced by the response from the second call. I've attempted to control the usage of the serial port by using 'Mutex.WaitOne' but that doesn't seem to have an affect. All the calls to the laser are being generated by Windows' messages within the GUI. Does anyone know of a way to control the flow of calls to the laser class? I'm using Visual Studio 2008 and Managed C++. Thanks, George

    George

    Managed C++/CLI help csharp c++ visual-studio question

  • Checking for presence of System::IO::Ports::SerialPort
    B BubbaGeeNH

    I'm attempting to write communication software to talk to a laser via RS232. If I setup a Managed C++ class that has a SerialPort variable how can I test the variable to see that it is present or has a valid value. So in my code I have: .h file -------- SerialPort^ sp; .cpp file --------- if(sp) //Testing to see if 'sp' has already been assigned a value. { if(sp->IsOpen) sp->Close(); } sp = gcnew SerialPort("Com1"); Any idea how to check to see if an Object handle has been assigned? Thanks,

    George

    Managed C++/CLI c++ question sharepoint testing beta-testing

  • Looking for guidance with regards to System::String variables and functions.
    B BubbaGeeNH

    I'm attempting to pass a String^ variable to a function and updating the variable within the function. When I return from the function I want the updated variable to be what was assigned in the function. (I'm still trying to learn the Managed C++ coding and can't find a good example.) #include "stdafx.h" using namespace System; void ChangeString(String^); int main(array ^args) { String^ Outside = gcnew String("Outside"); ChangeString(Outside); Console::WriteLine(Outside); return 0; } void ChangeString(String^ variable) { Console::WriteLine("Recieved: {0}",variable); variable = "Changed"; Console::WriteLine("New: {0}",variable); };

    George

    Managed C++/CLI c++ data-structures tutorial

  • What is WXF and WXC?
    B BubbaGeeNH

    I just received some source code from a company so we can modify their user interface to work with our programs but I've run into a little snag. What language uses WXF and WXC as their file extensions? I've never come across it before. Thanks, George

    IT & Infrastructure

  • Problem with .Net's NamedPipeServerStream and NamedPipeClientStream
    B BubbaGeeNH

    I'm trying to use .Net 3.5's NamedPipeServerStream and NamedPipeClientStream and I'm having some problems. I'm able to send one commmunication between the client and server programs but when the client attempts to connect a second time it hangs. Any idea what I'm doing wrong? SERVER CODE ----------- Imports System Imports System.IO Imports System.IO.Pipes Imports System.Threading Imports System.Windows.Forms Public Class SimServer Private Delegate Sub InvokeDelegate(ByVal text As String) Private newThread As New Thread(New ThreadStart(AddressOf PipeServer)) Private Sub PipeServer() ' Read the request from the client. Once the client has ' written to the pipe, its security token will be available. Dim pipeServer As New NamedPipeServerStream("CognexPipe", PipeDirection.InOut, 10) Dim sr As New StreamReader(pipeServer) Dim sw As New StreamWriter(pipeServer) Dim line As String Dim retline As String While (1) pipeServer.WaitForConnection() sw.AutoFlush = True While (pipeServer.IsConnected) If (sr.Peek > 0) Then line = sr.ReadLine() Me.BeginInvoke(New InvokeDelegate(AddressOf TextHandler), line) retline = "Received: " + line sw.WriteLine(retline) End If End While End While End Sub Private Sub Form3_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load newThread.Start() End Sub Private Sub Form3_Close(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.FormClosing newThread.Abort() End Sub Public Sub TextHandler(ByVal text As String) ReceivedBox.Text = text ReceivedBox.Update() End Sub End Class CLIENT CODE ----------- Imports System Imports System.IO Imports System.IO.Pipes Imports System.Threading Public Class SimClient Private Sub SendButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles SendButton.Click Dim pipeClient As New NamedPipeClientStream(".", "CognexPipe", PipeDirection.InOut) Dim sr As New StreamReader(pipeClient) Dim sw As New StreamWriter(pipeClient) Dim line As String Dim retline As String If Not pipeClient.IsConnected Then pipeClient.Connect() End If If pipeClient.IsConnected Then

    Visual Basic csharp sysadmin security help question

  • Need some suggestions.
    B BubbaGeeNH

    Currently have a VB6.0 program that is used to monitor/control a device via a serial connection. It is constantly polling the device to keep data up to date and to keep the communication link active. My problem is finding a reliable way to access the data via an external program (written in C++)(ProgC++). The previous programmer has been using "SendMessage" to send information to the VB6.0 program(ProgVB) and setup portions of device but his way of addressing getting information back from the program doesn't work. He was trying to use a similiar "SendMessage" approach but didn't take into account that the SendMessage from ProgC++ until the SendMessage from ProgVB finishes and that will only finish once ProgC++ reads it and acts on it. So it gets stuck in a cycle where neither program will run until the other finishes. Thought of using PostMessage but run into the issue where the data may not be valid in time for me to use it since PostMessage never reports when the message has been handled like SendMessage does. Is there a way to build external subroutines into VB6.0 that I can access from outside of the program? Thanks, George

    Visual Basic help c++ question workspace

  • Am I looking at this correctly? [modified]
    B BubbaGeeNH

    Sorry for the lack of information but I was just trying to get a feel for whether my approach is correct and didn't realize you needed more information about Sherlock32. From what I understand about it it does run as a COM server and it has some functions available under its COMM server that should allow me to control it and get information from it. I'll take a look at the things you suggested. I'm using Visual Studio C++ 6.0 to write my code and sticking with C++ & MFC for my coding. They haven't converted over to using .NET at my office yet. Thanks, George

    COM question com help tutorial announcement

  • Am I looking at this correctly? [modified]
    B BubbaGeeNH

    This is what I'm trying to do. I'm trying to write a DLL that will give me access to COM components that are available from an Off-The-Shelf product (Sherlock32) so I can get information from it while it is running. I've seen a lot of examples of how to write stand-alone code but I'm lost as to how to handle everything properly. Now if I understand things I can use: #import "c:\sherlock\bin\sp32.exe" named_guids no_namespace in my header file to get access to the CSLID (CSLID_Sherlock) which was put in the exe. Then I can use the following code to get access to the various features. ISherlockPtr m_Sherlock; CoInitialize(NULL); m_Sherlock->CreateInstance(CSLID_Sherlock); m_Sherlock->function; CoUnitialize(); I'm I at least headed in the correct direction? I know I need to add some error checking to make sure the instance was created and the function is returning the correct stuff. One big question I have is should I create the instance once and hold on to it for the length of the use of the DLL or should I create and release it every time I want access to the functions? [Side note: For those of you that are thinking why don't I just put my access code in the program that needs access to Sherlock here is the reason. The DLL is going to be used by a scripting program/language that has DLL capabilities but not COM.] Thanks, George -- modified at 8:54 Friday 5th October, 2007

    COM question com help tutorial announcement

  • Communication between C++ DLL and VB6 window.
    B BubbaGeeNH

    Thanks for trying to help but not what I'm trying to do. I'm calling a function in the DLL from a third party software, the function then sends a message to a different program, written in VB6, and waits for that program to reply. The way it was written when I got the code was the VB6 code was sending a message (using SendMessage) back to the DLL that called the VB6 code. Now if I understand Windows correctly it will never finish because neither SendMessage will return because the last SendMessage won't be processed until the DLL responds to it and the DLL won't read it until the VB6 code responds to the initial SendMessage. ie. Software1 ----> DLL ----> Software2(VB6) -----> DLL -----> Software1 Does that explain it better? I've looked at using the WPARAM and LPARAM but can't find how to use them in VB6 because it looks like they are only passed by value. Maybe setting some shared variables in the DLL and having both programs access the variables. George

    C / C++ / MFC c++ performance

  • Communication between C++ DLL and VB6 window.
    B BubbaGeeNH

    What I need to do is have a C++ DLL send messages to a VB6 Program window and get back data (long and double) that is in the VB Code. I can get the handle to the window using FindWindow and send messages to it but I'm having problems getting the data back from the VB6 program without getting callback timeouts. Keep in mind the DLL currently creates a CDialog window to handle the communication between the two since the program that is calling the DLL is third party software from Aerotech that can use functions in C++ DLLs to perform functions that it can't do internally. Execution speed of the DLL functions are important so I would like to stay away from using I/O files to pass the data. Thanks, George

    C / C++ / MFC c++ performance
  • Login

  • Don't have an account? Register

  • Login or register to search.
  • First post
    Last post
0
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups