|
What linked list are you using ? Isn't there an InsertAt method ?
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
This is actually a VB6 question. I'm trying to set up a VB DLL so that if it can't instantiate an external COM object because it is not registered properly it would run regsvr32.exe against the DLL to register the object and then try to instantiate it again. I'm using CreateProcess to run regsvr32 against the DLL and the problem I'm running into is that when the CreateProcess method is invoked, regsvr32 generates a dialog box indicating that LoadLibrary can't find the specified module. The module it prints out is the correct path to the DLL. Does anyone know how I can get this working?
|
|
|
|
|
I'm not sure, but it sounds like you're passing in a path to the .DLL that includes spaces. You'll have to enclose the path in double quote marks so the command line you pass to CreateProcess looks more like this:
REGSVR32 "C:\Program Files\Folder\Some Folder\MYDLL.DLL"
If not, RegSvr32 will look for a file called "Program" at the root of C:, not MYDLL.DLL in the path you want.
To build the path string with quote marks inside it, you have to use 2 quotes to get 1:
Dim path As String = """C:\Program Files\Folder...MYDLL.DLL"""
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
I am but I am enclosing the path in double-quotes. I found this out the first time I tried it without double-quotes. Regsvr32 complained about not being able to find the C:\Program component.
What I found was that I could set up an console app built in Visual C++ to do this and it worked fine if I ran it from the command line. But if I called the Visual C++ executable from my VB app, it gave me the same error. It looks like it has something to do with trying to run regsvr32.exe from a VB instantiated thread.
|
|
|
|
|
I never had a problem running RegSvr32 from VB6 or VB.NET. Since a process gets it's own seperate thread, regardless of which thread you create it from in your app, I don't see how this would cause a problem. Hmmm... Are you running multiple copies of RegSvr32 at the same time? (grasping at straws here...)
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
I'm just setting up the command line in a string and passing the string to CreateProcess like this:
Dim cmdLine as String
cmdLine = "regsvr32.exe " & Chr(34) & "C:\Program Files\ProgramFilesFolder\DllFilename.dll")
I'm passing a NULL string for the application name, a NULL for the process attributes and thread attributes, not inheriting the handles, NORMAL_PRIORITY_CLASS for the priority class, NULL for the environment pointer and current directory, and pointers to a startup info and process info structure with just the sizes set in both. Should any of these parameters on the CreateProcess call be set differently?
|
|
|
|
|
Sorry. In the previous example I should have added the trailing Chr(34) for the ending set of double-quotes instead of the end paren.
|
|
|
|
|
I'm not running multiple copies of regsvr32 that I'm aware of. The only thing I can think of that would cause problems is that the process that I'm invoking regsvr32 from doesn't have admin privileges. However, I can set up a test app using VB and run it from an account that I know have admin privileges and I get the same results. If I set up a Visual C++ app that does the same exact thing as the VB test app, it works perfectly.
-- modified at 12:37 Monday 5th March, 2007
|
|
|
|
|
As an alternative to regsvr32, you could (pinvoke) call the DllRegisterServer function in the Dll. Regsvr32 executes this function in the Dll to perform the registration.
|
|
|
|
|
Hey
I have inherits the Textbox-control but i'm
having problem with my properties that i have added.
this is the class with the property added:
Public Class TPTextBox
Inherits System.Windows.Forms.TextBox
private _blndirtyEnabled as boolean
Public property DirtyEnabled as boolean
set (byval value as boolean)
_blndirtyEnabled = value
end set
Get
return _blnDirtyEnabled
Get
end property
end class
now i want to edit the value through the "properties"-window in designmode to "true"
but it always returns to "false" when i try to save the Form that i have dragged the control to.
in the designer file the form has put this line:
me.TextBox1.DirtyEnabled = false
i want it to store the value that i have changed it to but it always return to "false".
i have removed the line but it wont work.
whats is wrong
|
|
|
|
|
Odd, I tried it and didn't have any trouble. Did you try changing that line so it sets the property to true, instead of just removing it. Also you might want to try using the control in a new project to see if the problem persists.
|
|
|
|
|
<defaultvalue(gettype(boolean), "true"),="" category("appearance"),="" description("")=""> _
Public Property DirtyEnabled() As Boolean Implements Interfaces.IDirtyTracking.DirtyEnabled
Get
Return _blnDirtyEnabled
End Get
Set(ByVal value As Boolean)
_blnDirtyEnabled = value
End Set
End Property
i forgott to mention that i have this above the "property"
<defaultvalue(gettype(boolean), "true"),="" category("appearance"),="" description("")=""> _
when i removed it it worked fine.
|
|
|
|
|
A user fills out info on a TabPage in a TabControl. When the user clicks on another TabPage I want to validate the information before switch to the new TabPage. So far I'm using the Leave event to validate the info but if there is a problem I want it to stay on that TabPage. How can I prevent it from switching to a new TabPage if needed?
|
|
|
|
|
can't you disable all other tab pages until they have saved?
|
|
|
|
|
Urgent!!!
Can someone please help me about how to read multiple .doc files, say 40 word files into an array of String
mmorupisi
|
|
|
|
|
I have the following code in a DLL, and it must be called from a VB6 application.
That's the code:
#######################################
#include
struct tpteste
{
int i;
};
void __stdcall test( tpteste **l )
{
tpteste *t = new tpteste[4];
t[0].i = 99;
t[1].i = 98;
t[2].i = 97;
t[3].i = 96;
*l = t;
}
void __stdcall doNothing( void )
{
tpteste *w = NULL;
test(&w);
}
#######################################
I need to discover how to call the test function from VB passing a pointer-to-pointer (or any workaround).
If someone can help... thanks in advance.
|
|
|
|
|
VB6 doesn't support pointers, so I fail to see how a poiinter-to-a-pointer is going to work. VB can pass in parameters ByRef, which is a pointer to an object or value, but that's about as far as it's going to go.
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
i am doing a world quiz. what is the capital city of...? once a question has been asked, how can i stop the question from being repeated until the quiz has been reset.
Regards
Zeldacat
|
|
|
|
|
Store your used questions to a HashTable, then when you want to ask a new question check whether it already exists there.
|
|
|
|
|
That depends on how you store the questions and how you pick the questions to ask.
You can keep a list of unused questions, and remove it from the list once it's used. You can keep a flag in each question that determines if it has been used or not. You can store an identifier or reference of the used questions to compare against. You can prepare a list of questions in the order that they will be asked and just loop through the list.
---
single minded; short sighted; long gone;
|
|
|
|
|
I suggest adding them to a list and deleting them after they are used. You can add them as strings to a string collection.
Dim Questions as system.collections.specialized.stringcollection<br />
<br />
Dim UsedQuestion as system.collections.specialized.stringcollection<br />
<br />
dim ranQuestion as new random<br />
<br />
Dim CurretnQuestion as string = questions.item(ranquestion.next(-1, questions.count +1 )<br />
<br />
questions.remove(indexof(CurrentQuestion))<br />
<br />
UsedQuestions.add(currentQuestion)
In this way, you never risk repeating a question.
Posted by The ANZAC
|
|
|
|
|
Hi all! I have a VBA question. I know what the error means when doing a Windows("Workbook Name").Activate or a Sheets("Sheet Name").Select. It means that the object does not exists? Well, I am pretty sure.
But this is really strange to me. There is one Workbook named EndOfMonth.xls. The macro is from this workbook. There is also one worksheet in the workbook named EndOfMonth.
The Sheets("EndOfMonth").Select command is where I am getting the error. But I copied and pasted this from a recorded macro and the sheet is there.
Why would this happen?
Thanx in advance!
Jude
|
|
|
|
|
I have an application that I'm writing to load a spreadsheet, massage the data, and then populate a sql server table. This code works great except the cell for a date field in the spreadsheet is saying it's dbnull but when you look at the spreadsheet and the date is there and valid.
Dim oConn As System.Data.OleDb.OleDbConnection = Nothing
Dim ds As System.Data.DataSet = New System.Data.DataSet, dsRow As Data.DataRow = Nothing
Dim oComm As System.Data.OleDb.OleDbDataAdapter = Nothing, dsCol As Data.DataColumn = Nothing
Dim oAdj As Adjuster = Nothing, oState As New Adjuster.State
Try
oConn = New System.Data.OleDb.OleDbConnection("provider=Microsoft.Jet.OLEDB.4.0; " & _
"data source='c:\temp\adjusterlicense.xls';" & _
"Extended Properties=Excel 8.0;")
oComm = New System.Data.OleDb.OleDbDataAdapter("select * from [CZ Adjuster Licenses$]", oConn)
oComm.Fill(ds)
For i As Int16 = 8 To ds.Tables(0).Rows.Count - 1
dsRow = ds.Tables(0).Rows(i)
.
.
.
'col 9 = 10/31/07
'col 10 = AJ40008453
For iState As Int16 = 9 To ds.Tables(0).Columns.Count - 1 step 2
'' why is IsDBnull(dsRow(9)) = True when IsDBNull(dsRow(10)) = False
Next
Next
What's interesting is that if I export this file into a comma delimited file, the date is there.
Any help would be greatly appreciated...
Nathan
|
|
|
|
|
Has the column been established as a type that wont accept the date by that point?
Cleako
|
|
|
|
|
The first row of the spreadsheet is blank which I thought maybe causing the problem. I put a dummy date in the date column so that it would be looked at as a date but it didn't help.
|
|
|
|