|
It is possible. Go to the link I provided in my previous post. It contains several articles by Microsoft on how to do this.
|
|
|
|
|
In my opinion, it is impossible to do that.
|
|
|
|
|
Hi,
As far as i could think of it, why don't you convert the .NET code into a .NET Assembly (DLL) and register it in GAC so that you can use it in VB6 by adding it's reference into your VB6 project?
Hope that might help and if you find some better way then please post it on the forum.
With warm regards,
KEDAR
-- modified at 7:45 Wednesday 1st February, 2006
|
|
|
|
|
Hi,
We have find a good solution.
You can see it in french forum : http://www.developpez.net/forums/viewtopic.php?t=446317
And download source for VB6 here : http://thierry_aim.developpez.com/downloads/AutoUpdateExe.zip
Thanks for your help and interrest.
Bye
|
|
|
|
|
I'm trying to grab the share name (e.g.: \\server1\share) of an already mapped drive (Q:\). I've been looking for like a week on how to do this. I can disconnect drives, map drives and bring up the Win dialagos to do the same but I just can't find a way to grab that name. I just want to put it into a text box on the form Using vb.net on XP.
PLEASE HELP
thanks, N
-- modified at 14:06 Monday 23rd January, 2006
|
|
|
|
|
Something like this:
Private Const NO_ERROR = 0
Private Const ERROR_MORE_DATA = 234
Private Declare Auto Function WNetGetUniversalName Lib "mpr.dll" ( _
<MarshalAs(System.Runtime.InteropServices.UnmanagedType.LPTStr)> _
ByVal lpLocalPath As String, _
ByVal dwInfoLevel As INFO_LEVEL, _
ByVal lpBuffer As IntPtr, _
ByRef lpBufferSize As Integer _
) As Integer
Private Structure REMOTE_NAME_INFO
<MarshalAs(System.Runtime.InteropServices.UnmanagedType.LPTStr)> _
Public lpUniversalName As String
<MarshalAs(System.Runtime.InteropServices.UnmanagedType.LPTStr)> _
Public lpConnectionName As String
<MarshalAs(System.Runtime.InteropServices.UnmanagedType.LPTStr)> _
Public lpRemainingPath As String
End Structure
Private Enum INFO_LEVEL As Integer
UNIVERSAL_NAME_INFO_LEVEL = 1
REMOTE_NAME_INFO_LEVEL = 2
End Enum
Public Function GetUniversalName( _
ByVal Path As String, _
ByRef UniversalName As String, _
ByRef ConnectionName As String, _
ByRef RemainingPath As String) As Boolean
' When successful, returns TRUE with UniversalName,
' ConnectionName, and RemainingPath data. If not
' successful, it may be the drive is local and not mapped.
Dim buffer As Integer
Dim ptrbuffer As IntPtr
Dim status As Integer
Dim rni As REMOTE_NAME_INFO
Dim Success As Boolean
Dim SafteyCount As Integer = 0
UniversalName = ""
ConnectionName = ""
RemainingPath = ""
buffer = 1024
ptrbuffer = Marshal.AllocHGlobal(buffer)
status = WNetGetUniversalName( _
Path, INFO_LEVEL.REMOTE_NAME_INFO_LEVEL, _
ptrbuffer, buffer)
Do While True
Select Case status
Case NO_ERROR
rni = Marshal.PtrToStructure(ptrbuffer, GetType(REMOTE_NAME_INFO))
UniversalName = rni.lpUniversalName
ConnectionName = rni.lpConnectionName
RemainingPath = rni.lpRemainingPath
Success = True
Exit Do
Case ERROR_MORE_DATA
If SafteyCount > 3 Then
Success = False
Exit Do
End If
SafteyCount += 1
Marshal.FreeHGlobal(ptrbuffer)
ptrbuffer = Marshal.AllocHGlobal(buffer)
status = WNetGetUniversalName(Path, _
INFO_LEVEL.REMOTE_NAME_INFO_LEVEL, ptrbuffer, buffer)
Case Else
Success = False
Exit Do
End Select
Loop
Marshal.FreeHGlobal(ptrbuffer)
Return Success
End Function
Hope that helps
progload
|
|
|
|
|
Thanks !!
|
|
|
|
|
I've inherited a VB6 app with a TreeView.
The child nodes are loaded when the parent is expanded.
It all works except that part of the tree can be recursive (A parent of B parent of C parent of A).
If a user selects node A and presses * on the keypad the tree tries to expand all of A's tree thus ending up in an infinite recursion.
How can I trap this (eat the * or expand only 1 level).
TIA
PeteB
I wouldn't say "he's not the sharpest knife",
I'd say "he's a spoon."
|
|
|
|
|
|
Thanks, but I couldn't find any relevant info about expand-all functionality on that page.
PeteB
|
|
|
|
|
|
Sorry, that one doesn't help either. ExpandAll is not available in VB6 so I can't intercept it and prevent the behaviour
PeteB
I wouldn't say "he's not the sharpest knife",
I'd say "he's a spoon."
-- modified at 6:06 Wednesday 1st February, 2006
|
|
|
|
|
|
That looks really good. Unfortunately I don't have the time to replace the standard tree (especially with getting the code security checked) and any new projects are .Net
PeteB
I wouldn't say "he's not the sharpest knife",
I'd say "he's a spoon."
|
|
|
|
|
Having been unsuccessful in trapping the expand all event, I've simply trapped the keystrokes and filtered out the keypad *.
Not ideal but it works...
PeteB
I wouldn't say "he's not the sharpest knife",
I'd say "he's a spoon."
|
|
|
|
|
Hello,
I have developed an application to call a C++ DLL from VB.
If I send the values to the functions of DLL as Call By Value method, it gives correct output.
If I do the same through Call By Reference method, it gives improper values as result.
For example,
Instead of printing 47000, it prints the value 2.55471e-041.
Please help me to clear this problem.
Premalatha
|
|
|
|
|
Please tell me you rewrote the C++ function to accept a parameter pass by reference? Without changing BOTH the C function and the VB Declaration, you're trying to fit a square peg in a round hole.
If the C++ function is expecting a parameter passed by value, you obviously can't pass in a reference to it. The opposite is also true...
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
FloatPtr = & max_ceiling;
for(i=2; i<7; i++, FloatPtr++)
*FloatPtr = atof(GetValue(instr,s,128));
This code i wrote in C++ within a function. max_ceiling is the array.
GetValue is a function which reads single line from the binary file(instr) and converts to value to update in text file.
In this for loop, i have to get values like 47000 516 0.63 3000 100. But i am getting the values as 2.55471e-041, 89224, -2.26464e-041, 2.48352e-041,2.07628e-040
This is my problem
|
|
|
|
|
This isn't enough to diagnose the problem. You have to post the function header that is defined in the C++ code. Yout also have to post the VB Declare statement that defines how VB passes parameters.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
VB:
Private Declare Function FirstMethod Lib "C:\Premalatha\C++\17_01_06-ACDB_CON_DLL\Debug\ACDB_CON.dll" (ByVal ArgCount As Integer, ByVal Args0 As String, ByVal Args1 As String, ByVal Args2 As String, ByVal Args3 As String) As Boolean
C++:
#include <stdexcept>
#include "acdbcon.hpp"
#include <windows.h>
using namespace std;
bool __stdcall FirstMethod(int argc,char argv0[],char argv1[],char argv2[],char argv3[])
{
char *argv[4];
argv[0]=argv0;
argv[1]=argv1;
argv[2]=argv2;
argv[3]=argv3;
MessageBox(NULL,argv[0],"Filename",NULL);
MessageBox(NULL,argv[1],"Input",NULL);
MessageBox(NULL,argv[2],"Output",NULL);
MessageBox(NULL,argv[3],"Choice",NULL);
CAcdbCon Con;
Con.ACDBmain(argc,argv);
return true;
}
-----------------------------------------------------------------------------
void CAcdbCon::ACDBmain(int argc, char * argv[]) //JLF 10/30/02
{
MessageBox(NULL,"Con:ACDBMain","Func",NULL);
//***************** NOTICE NOTICE NOTICE *****************************
// Always update Software version and the date the changes were made
// for ANY changes made to the tool. For minor changes and fixes,
// update the decimal value, whereas major revisions update the
// first number
const char * Version="2.01";
const char * Date="November 29, 2002";
//Error is true if the the MainEventProcessor method returns with an error,
// otherwise it is false.
int Error;
//MainDriver object which is the user interface driver.
CDriver MainDriver(Version,Date);
//Start the main processing loop.
Error = MainDriver.MainEventProcessor(argc, argv);
//Display that the main processing loop is completed (with errors)
if(Error)
{
cout << endl << "Application terminated with errors." << endl;
//Pause the screen so the user can see the results
int ch = 0;
cout << "Type ESC to Exit";
do
ch = _getch();
while(ch != 27); //search for ESC character
}
};
---------------------------------------------------------------------------
int CDriver::MainEventProcessor(int argc, char * argv[]) //(JLF 10/30/02)
{
MessageBox(NULL,"Driver:MainEvent","Func",NULL);
//Flag is set to TRUE as long as processing is necessary. When the user
// selects EXIT program then Running is set to FALSE.
int Running = 1;
//Operating mode. BATCHMODE reads a script file to control the program.
// INTERACTIVEMODE allows the user to interactively control the program.
// COMMANDMODE the user has entered information on the command line (JLF 10/30/02)
enum MODE_TYPE {SEL_BATCHMODE,SEL_INTERACTIVEMODE,
SEL_COMMANDMODE} Mode = SEL_INTERACTIVEMODE;
try // Exception handler
{
//set up the default paths
strncpy(ToolPath, argv[0], FILENAME_MAX);
if(strrchr(ToolPath, '\\') != NULL)
*(strrchr(ToolPath, '\\')) = '\0';
_getcwd(CWDPath, FILENAME_MAX);
//IF there are command line parameters, run in COMMANDMODE (JLF 10/30/02)
if(argc > 1)
Mode = SEL_COMMANDMODE;
//Processing loop. Repeat until the user selects EXIT.
while(Running)
{
//Mode switch. BATCHMODE reads a script file to control the program.
// INTERACTIVEMODE allows the user to interactively control the program.
// COMMANDMODE the user has entered information on the command line
switch(Mode)
{
case SEL_INTERACTIVEMODE:
{
//Display the message if this is not the first time through here
if(Running != 1)
cout << endl << Message.c_str() << endl << endl;
else
Running++;
InteractiveMode(argc,argv);
break; //INTERACTIVEMODE
}
case SEL_BATCHMODE:
{
BatchMode();
//If called on command line and the file is complete, set up to exit
if(AcftDirection==SEL_TOGGLEMODE && argc != 1)
AcftDirection=SEL_EXIT;
break; //BATCHMODE
}
case SEL_COMMANDMODE: //(JLF 10/30/02)
{
MessageBox(NULL,"Command","Mode",NULL);
CommandLineMode(argc, argv);
//The main loop should run only once, so set the variable to stop
// after this has completed.
Running = 0;
break; //COMMANDMODE
}
default:
{
string Error("internal Mode must be BATCHMODE, INTERACTIVEMODE or COMMANDMODE.");
throw(Error);
}
}; //end of Mode switch
//Option switch. BINARY_TO_HUMAN converts a binary file to a human
// readable file, HUMAN_TO_BINARY converts a human readable file to a
// binary file, SPREAD_COVS spreads the covarience of the Wf P Matrix
// and the P Matrix, BATCH switches from interactive to batch mode, and
// EXIT quits the program.
switch(AcftDirection)
{
case SEL_BINARY_TO_HUMAN:
{
Buffer->ReadBinaryFile(InFilename);
//Do NOT pass the path to be written to the output file
char * PtrNameOnly = strrchr(InFilename, '\\');
if(PtrNameOnly == NULL)
PtrNameOnly = &InFilename[0];
else
PtrNameOnly++;
Buffer->WriteHumanReadableFile(OutFilename, PtrNameOnly);
// Set the Message string to be displayed to the user.
Message="Converted ";
Message+=InFilename;
Message+=" to ";
Message+=OutFilename;
Message+=".";
break; //BINARY_TO_HUMAN
}
case SEL_HUMAN_TO_BINARY:
{
Buffer->ReadHumanReadableFile(InFilename);
Buffer->WriteBinaryFile(OutFilename);
// Set the Message string to be displayed to the user.
Message="Converted ";
Message+=InFilename;
Message+=" to ";
Message+=OutFilename;
Message+=".";
break; //HUMAN_TO_BINARY
}
case SEL_SPREAD_COVS:
{
Buffer->ReadBinaryFile(InFilename);
Buffer->SpreadPMatrix((float)0.249);
Buffer->SpreadWfPMatrix((float).199);
Buffer->WriteBinaryFile(OutFilename);
// Set the Message string to be displayed to the user.
Message="Spread the P matrix of ";
Message+=InFilename;
Message+=".";
break; //SPREAD_COVS
}
case SEL_TRACE:
{
const int SigFig = 5; //The number of significant figures
// of the trace calculations.
double PTrace=0.0; //The value of the P matrix trace.
char PTraceChar[SigFig+1]; //The character representation of the
// P matrix trace.
float WfPTrace=0.0; //The value of the Wf P matrix trace.
char WfPTraceChar[SigFig+1]; //The character representation of the
// Wf P matrix trace.
//Read the binary file
Buffer->ReadBinaryFile(InFilename);
//Calculate the trace of the P matrix and convert it to a string
PTrace = Buffer->TracePMatrix();
gcvt(PTrace,SigFig,PTraceChar);
//Calculate the trace of the Wf P matrix and convert it to a string
WfPTrace = Buffer->TraceWfPMatrix();
gcvt(double(WfPTrace),SigFig,WfPTraceChar);
// Set the Message string to be displayed to the user.
Message="The trace of the ";
Message+=InFilename;
Message+=" file.\n";
Message+="Rated Fuelflow Matrix ";
Message+=WfPTraceChar;
Message+=" (1.25).\n";
Message+="Thrust Minus Drag Matrix ";
Message+=PTraceChar;
Message+=" (2.75).\n";
if((PTrace<2.75)&&(WfPTrace<1.25))
Message+="Learning is VALID.";
else
Message+="Learning is NOT VALID.";
break; //TRACE
}
case SEL_TOGGLEMODE:
{
if(Mode==SEL_INTERACTIVEMODE || Mode==SEL_COMMANDMODE)
{
//Switch mode to BATCHMODE
Mode=SEL_BATCHMODE;
//Open the script file. If the script file is not found
// then throw the file not found exception.
ScriptFile.open(ScriptFileName);
if(!ScriptFile) throw XFileNotFound(ScriptFileName);
}
else //Mode==BATCHMODE
{
//Switch mode to INTERACTIVEMODE
Mode=SEL_INTERACTIVEMODE;
//Set the Message string to be displayed to the user.
Message="The scriptfile ";
Message+=ScriptFileName;
Message+=" processed successfully.";
};
break; //BATCH
}
case SEL_EXIT:
{
//Exit the main while loop
Running=0;
break; //EXIT
}
case SEL_INVALID:
{
// Set the Message string to be displayed to the user.
Message="ERROR - Invalid option";
break; //INVALID
}
default:
{
// Set the Message string to be displayed to the user.
Message="ERROR - Invalid option";
AcftDirection=SEL_INVALID;
break; //default
}
}
}
return 0;
}
catch(string P) //Catch the generic string exception.
{
cout << endl << "ERROR - " << P.c_str() << endl;
return 1;
}
catch(XFileNotFound xf) //Catch the thrown file not found exception.
{
xf.OutMessage(cerr);
return 1;
}
catch(XFileCouldntOpen xf) //Catch the thrown file couldn't open exception.
{
xf.OutMessage(cerr);
return 1;
}
};
void CDriver::CommandLineMode(int argc, char * argv[])
{
MessageBox(NULL,"Driver:Command","Func",NULL);
//Set up the input path
strncpy(InputPath, argv[1], FILENAME_MAX);
if(strrchr(InputPath, '\\') != NULL)
*(strrchr(InputPath, '\\')) = '\0';
//If there are parameters on the command line, process for COMMANDMODE
// First parameter always the input file or script file.
strncpy(InFilename, argv[1], FILENAME_MAX);
AircraftDatabaseFileTypeVersion(); //Determine the direction
switch(InFileType)
{
case SCRIPT:
AcftDirection = SEL_TOGGLEMODE;
strcpy(ScriptFileName, InFilename);
InFilename[0] = '\0';
break;
case BINARY:
case ASCII:
//What type of request is this? BINARY_TO_HUMAN or HUMAN_TO_BINARY
if(InFileType == BINARY)
AcftDirection = SEL_BINARY_TO_HUMAN;
else
AcftDirection = SEL_HUMAN_TO_BINARY;
//Second parameter if present is the output filename
// If output filename not provided, use InFilename with different extension
if(argc > 2)
strncpy(OutFilename, argv[2], FILENAME_MAX);
else
{
strcpy(OutFilename, InFilename);
if(InFileType == BINARY)
strncpy((strstr(OutFilename,".")), ".OUT", 4);
else
strncpy((strstr(OutFilename,".")), ".LRN", 4);
}
break;
default:
string Error("File must be a valid Aircraft Database or Script file");
throw(Error);
break;
} //end of InFiletype switch
};
-----------------------------------------------------------------------------
void CAircraftDataV2::ReadHumanReadableFile(ifstream & instr)
{
MessageBox(NULL,"DataV2:ReadHuman","Func",NULL);
//Temporary character array and integer
char s[128];
int i;
short TempShort;
unsigned short Flap1, Flap2, Flap3, Flap4;
//Tempory pointer to a float and to a integer
float * FloatPtr;
short * ShortPtr;
//Set all the characters in the acft_type and acft_tail_no strings to NULL
for(i=0; i<sizeof(acft_type); i++)
="" acft_type[i]="0x00;
" for(i="0;" i<sizeof(acft_tail_no);="" acft_tail_no[i]="0x00;
" read="" and="" flush="" the="" aircraft="" data="" label="" (ie:="" acft_type,="" acft_tail_no,="" ...)
="" ignoring="" white="" space.="" set="" last="" character="" to
="" a="" null="" terminator="" to="" guarentee="" that="" string="" is="" properly="" terminated.
="" replace="" with="" an="" 0x80.
="" strncpy(acft_type,="" getvalue(instr,s,="" 128),="" sizeof(acft_type));
="" acft_type[sizeof(acft_type)-1]="(char)0x00;
" acft_type[strlen(acft_type)]="(char)0x80;
" if="" acft_tail_no="" ??????="" then="" null.
="" 0x80.="" fms="" requires="" last
="" of="" acft_type="" array="" be="" 0x80,="" so="" it.
="" strncpy(acft_tail_no,="" getvalue(instr,s,128),="" sizeof(acft_tail_no));
="" acft_tail_no[sizeof(acft_tail_no)-1]="(char)0x00;
" acft_tail_no[strlen(acft_tail_no)]="(char)0x80;
" all="" character's="" sent="" must="" upper="" case,="" convert="" upper.
="" i<sizeof(acft_type);="" floatptr="" point="" max_ceiling.="" march="" through="" floats
="" reading="" data.="" labels="" as="" you="" go.
="" max_ceiling;
="" i<7;="" i++,="" floatptr++)
="" *floatptr="atof(GetValue(instr,s,128));
"
="" intptr="" num_engines.="" integers
="" shortptr="&" num_engines;
="" i<13;="" shortptr++)
="" *shortptr="atoi(GetValue(instr,s,128));
" engoutcd.="" engoutcd;
="" i<56;="" at_climb_detected.
="" instr.ignore(64,="" '="" ');
="" instr="">> hex >> TempShort;
at_climb_detected=(char)TempShort;
instr.getline(s, 128); //ignores the remaining values on the line
//Read and flush the aircraft data label and then the at_configured.
instr.ignore(64, ' ');
instr >> hex >> TempShort;
at_configured=(char)TempShort;
instr.getline(s, 128); //ignores the remaining values on the line
//Read and flush the aircraft data label and then the holdspd.
holdspd = atoi(GetValue(instr,s,128));
//Set the FloatPtr to point to the vref_factor. March through the floats
// reading the aircraft data. Flush the aircraft data labels as you go.
FloatPtr = & vref_factor;
for(i=59; i<62; i++, FloatPtr++)
*FloatPtr = atof(GetValue(instr,s,128));
//Read the appraoch and go around speeds and their instruction header.
instr.getline(s, 128);
instr.ignore(128, ' ');
instr >> dec >> Flap1 >> dec >> Flap2 >> dec >> Flap3 >> dec >> Flap4;
approach_speeds = Flap1 | (Flap2 << 4) | (Flap3 << 8) | (Flap4 << 12);
instr.getline(s, 128); //ignores the remaining values on the line
instr.ignore(128, ' ');
instr >> dec >> Flap1 >> dec >> Flap2 >> dec >> Flap3 >> dec >> Flap4;
go_around_speeds = Flap1 | (Flap2 << 4) | (Flap3 << 8) | (Flap4 << 12);
instr.getline(s, 128); //ignores the remaining values on the line
//Set the FloatPtr to point to the spare[0]. March through the floats
// reading the aircraft data. Flush the aircraft data labels as you go.
FloatPtr = & spare[0];
for(i=64; i
|
|
|
|
|
Hi All,
I m stuck with a problem
Can any body solve my problem ,
The problem is how we can add the custom control in the datagrid view column
Means i want to show aa user control in the a datagrid view column lik ethe simple combo box , button etc,
Thanks for ur great help in advance
Hema Chaudhry
|
|
|
|
|
Did you ever figure this out? Have any code? I want to try and put a control with a couple of labels and a checkbox and Ihaven't found any examples of how to do it.
Thanks
|
|
|
|
|
hellow to all .
i am writing in vb.net and useing the vb 6 MASKED Control .
when i try to write to it information from the database ..
i recive this error
Exception from HRESULT: 0x800A017C (CTL_E_INVALIDPROPERTYVALUE).
any help will be appreciated .
|
|
|
|
|
You might want to look at this[^] on MSDN.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Hi funs of vb.net,
I have rewrited (converted) some code with xyz.dll (C)
form vb6 to vb.net 2005 Ex.
Have change Long types to Integer - of course.
It works. B U T the resuts are differnt ???
I am sure of the vb6 results. The astronomical countings.
They are the same in vb6, c++ and even in vba2003.
Does anyone know something about it?
Mayby the beta version or so?
sbststtswbwgf
|
|
|
|
|