Jump to content
Xtreme .Net Talk

Volte

*Experts*
  • Posts

    2372
  • Joined

  • Last visited

Everything posted by Volte

  1. Here's a quick example. As you can see, it's a bit convoluted. #include <iostream> #include <string.h> using namespace std; int main(int argc, void* argv[]) { char* str = "abcabc<defdef"; char* match = strstr(str, "<"); char substr[1024]; // If no match, strstr points to a zero-length string if (strlen(match) == 0) return 0; // match is the address of the match, str is the address of the string, // so match - str is the length from the start of the string to the match. int substrlength = match - str; // Copy the first 'substrlength' chars from the original into the substring. // Also, you need to null-terminate the string which is what the line below does. strncpy(substr, str, (size_t)substrlength); substr[substrlength] = 0; cout << substr << endl; return 0; }It will output abcabc to the console. Note that strstr does not return the position of the substring inside the string, it returns the memory address of the match. For example, if "abcabc<defdef" is located at memory address 0x12345670, matching < with strstr will return a char* pointing to 0x1234676, because that's where the < is located. If you don't understand the way memory is handled in C++, you best learn before you start trying to get your head around things like strings. It'll benefit you greatly.
  2. Might I ask what this is for? There may be a better, less tacky way to do it.
  3. Making .NET use COM plugins would be rather difficult, and making C++ use .NET plugins is near impossible. I suggest you stick with one of the two and either write both the plugins and the host in C++ using COM, or write the plugins and the host in .NET using the .NET assembly technology. C++ and .NET just won't go together in that respect.
  4. You need to copy all the files into the same directory, rather than having separate directories for Disk 1, 2, 3 etc. I do the same thing with my .NET install (it's so very much faster) and that's what I had to do.
  5. If he wants to write in C++.NET, this is possible. All he has to do is make a class which implements your interface. Otherwise, no, there's not really a practical way to do this.
  6. Set its TabIndex property to 0. You can use the View -> Tab Stops option in the designer to visually select the order of tabs. The control with the TabIndex 0 will be selected first.
  7. Realistically, you can't, with regular C++. However, if you want to use C++.NET you can do it simply be referencing in the project. Otherwise there's not much you can do with it. If you want speed, you might look into using Platform Invoke to call the Windows GDI32 APIs rather than using GDI+ (which is slightly slower).
  8. You can't. Best you could do is do something like this:Dim b As Boolean = False Private Sub SetBool(state As Boolean) b = state 'do other stuff here, that you would do in the event if such thing existed End SubThen use SetBool(true) or SetBool(false) to set the boolean, rather than simply b = True or b = False.
  9. Well creating a Mobile Development board won't magically make mobile developers appear in there. You'll probably have just as much luck using General as another forum we create for it.
  10. You can always use the General forum for things which don't fit into other forums.
  11. Perhaps you should do a search in the MSDN. You're sure to find something.
  12. RemoveHandler Button1.Click, AddressOf Button1_ClickReplace Button1_Click is the sub which represents the click event.
  13. http://www.mentalis.org/index2.shtml
  14. Maybe you should try C++.NET?
  15. A UDT is a user-defined type in VB. I meant to say "structure", sorry. Anyway, I really don't understand what you're talking about. What do you mean by "C++ flexibility"? Storing pointers and manipulating their values is no more flexible than returning a structure and assigning the values upon returning. Aside from that, using the struct is much easier and cleaner.
  16. If you are using C#, I have my doubts as you whether you can accomplish it. If you were using C++, you could store the pointer to the variable easily and manipulate that. Using unsafe code is a possibility I suppose. I'll have to look at that. Is there a particular reason you want to use that way over the UDT way?
  17. What do you mean the C++ way? It would be the same no matter what language you use.
  18. You need to use the KeyCode event, and use the Keys enumeration to see which key is being pressed. Look at the MSDN.
  19. You might be able to with references, but the way I suggested is the way you should go about it.
  20. No advantage using the API over GetHitTest() as far as I can see.
  21. It doesn't work that way. Unless you change transpCol (the parameter, not the member) in the constructor, it will not change the referenced variable. Also, using the same name for the parameter and the member could be causing problems. For an options form, you should create a structure, like public struct DrawOptions { a.graphics.DrawingSurface drawSurface; Color transpColor; }Then, create a method to show the form, and return the options struct: public DrawOptions ShowOptions() { DrawOptions retVal; this.ShowDialog(); retVal.drawSurface = blah1; retVal.transpColor = blah2; return retVal; }Then use ShowOptions instead of ShowDialog.
  22. As long as you defined them the same way I did, you could do that. You can also enumerate all TextBoxes on the form:Dim tb As New TextBox For Each tb In Me.Controls tb.BackColor = Color.Red Next
  23. Use an array.Dim tb(9) As TextBox Dim i As Integer For i = 0 to 9 tb(i) = New TextBox 'set TextBox(i) properties Me.Controls.Add(tb(i)) Next i
  24. http://www.syncfusion.com/FAQ/WinForms/default.asp Clicky clicky.
  25. Do you have the sound scheme on your system turned off? That's what the MessageBeep API uses.
×
×
  • Create New...