|
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
|
|
|
|
|
There are not differences between how each handles a 32-bit signed Integer. But, of course, that depends entirely on your code and how it's passing parameters back and forth between languages.
Without any code samples, it's pretty much impossible to tell you what's going on.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Hi to all,
do you remember when we could make an easy UDP connection with VB 6.0?
we needed only to drag and drop the winsock... one minutes of codes and... we could make two applications "talk together"!!!
Now i have a problem!!!
I want to do the same thing with "Microsoft Visual Studio 2005"... but there is a new way to program that i don't know... even i don't know what is the name/identifier of this new language... (maybe "VB.NET 2005"?)
I have found, on this site, articles/source on UDP connection... but "Microsoft Visual Studio 2005" say that this code is old so it make a convertion... EVEN THOUGH I DON'T UNDERSTAND THE SOURCE!!!
There are a lot more lines of code...
Please Help Me... I NEED A SMALL EXAMPLE (SOURCE FOR "Microsoft Visual Studio 2005") LIKE TWO FORMS THAT CAN CHAT BETWEEN THEM!!!
THAKN YOU ALL!!!
And excuse my english
|
|
|
|
|
Hello!
I developed an application but I intend to write an uninstall app for it. I don't know how I could remove the software from Add/Remove programs section in the control panel with my code.
Any idea would be very helpfull
Thanks.
Bedri.
bckurd@e-kolay.net
|
|
|
|
|
|
|
B Journey wrote: I developed an application but I intend to write an uninstall app for it.
Do you develop your application in vb.net? As far as i know, when you build an installer for vb.net application it also has a property that ask you to allow to have uninstall feature or not. If you allow, after you install an application, the name of your application will appear in the ADD/REMOVE PROGRAM dialog box.
|
|
|
|
|