8 Replies - 1460 Views - Last Post: 05 August 2010 - 02:38 PM Rate Topic: -----

#1 Raz0r   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 7
  • Joined: 13-July 10

Need help with File Declaring..

Posted 05 August 2010 - 01:33 AM

Well I am writing a Product key checker for Windows vista and 7, well it works well in both of these operating systems, but the only problem I encounter here is that, I cannot check vista keys when I run this program in 7..and vice versa.

I declared the file as seen below.

Declare Auto Function PidGenX Lib "pidgenx.dll" (ByVal one As String, ByVal two As String, ByVal three As String, ByVal four As Integer, ByVal five As IntPtr, ByVal six As IntPtr, ByVal seven As IntPtr) As Integer


The thing I want to know is that how do you declare files, in the same directory as the exe file ie the app directory.

I wish to have the 'pidgenx.dll' files of both operating systems in folders corresponding to their OS ie vista's pidgenx.dll in folder called Pack\Vista\pidgenx.dll and for 7's as \pack\7\pidgenx.dll

I am completely new to programming and am currently trying to learn VB.net(2010 express edition), so please try to explain it properly. :)

Any help would be appreciated. :)

Thank you.

Is This A Good Question/Topic? 0
  • +

Replies To: Need help with File Declaring..

#2 biggerB   User is offline

  • Inactive
  • member icon

Reputation: 80
  • View blog
  • Posts: 760
  • Joined: 11-June 10

Re: Need help with File Declaring..

Posted 05 August 2010 - 02:37 AM

The current directory is the "curdir()" directory. For your next problem you could check for the current operating system and then do vista tasks for vista and 7 tasks for 7.

If My.Computer.Info.OSFullName.Contains("Windows 7") = True Then
            'tasks for windows 7
        End If
        If My.Computer.Info.OSFullName.Contains("Windows Vista") = True Then
            'tasks for windows vista
        End If

This post has been edited by biggerB: 05 August 2010 - 02:37 AM

Was This Post Helpful? 1
  • +
  • -

#3 FlashM   User is offline

  • D.I.C Lover
  • member icon

Reputation: 383
  • View blog
  • Posts: 1,195
  • Joined: 03-December 09

Re: Need help with File Declaring..

Posted 05 August 2010 - 04:48 AM

You can use:

Dim appDir As String = Application.StartupPath
''This is the folder where your application's exe file will be found.

This post has been edited by FlashM: 05 August 2010 - 04:49 AM

Was This Post Helpful? 2
  • +
  • -

#4 biggerB   User is offline

  • Inactive
  • member icon

Reputation: 80
  • View blog
  • Posts: 760
  • Joined: 11-June 10

Re: Need help with File Declaring..

Posted 05 August 2010 - 05:16 AM

View PostFlashM, on 05 August 2010 - 10:48 AM, said:

You can use:

Dim appDir As String = Application.StartupPath
''This is the folder where your application's exe file will be found.


FlashM the Application.StartupPath and CurDir() do the same thing so this could also be.
Dim appDir As String = CurDir()

Was This Post Helpful? 1
  • +
  • -

#5 FlashM   User is offline

  • D.I.C Lover
  • member icon

Reputation: 383
  • View blog
  • Posts: 1,195
  • Joined: 03-December 09

Re: Need help with File Declaring..

Posted 05 August 2010 - 05:56 AM

That's fine with me... I come from C# language and didn't know this method even exists...
Was This Post Helpful? 0
  • +
  • -

#6 Raz0r   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 7
  • Joined: 13-July 10

Re: Need help with File Declaring..

Posted 05 August 2010 - 09:26 AM

Wow thanks guys, really helpful...thanks :rockon:
Was This Post Helpful? 0
  • +
  • -

#7 raziel_   User is offline

  • Like a lollipop
  • member icon

Reputation: 469
  • View blog
  • Posts: 4,280
  • Joined: 25-March 09

Re: Need help with File Declaring..

Posted 05 August 2010 - 09:40 AM

View PostbiggerB, on 05 August 2010 - 01:16 PM, said:

View PostFlashM, on 05 August 2010 - 10:48 AM, said:

You can use:

Dim appDir As String = Application.StartupPath
''This is the folder where your application's exe file will be found.


FlashM the Application.StartupPath and CurDir() do the same thing so this could also be.
Dim appDir As String = CurDir()



yes but CurDir() is legacy code and if you remove the VB6 references the code will crash. and when microsoft remove vb6 support your program will crash too. so FlashM way is recommendable. and what is the point using VB.NET if your going to use old VB6 methods ?

This post has been edited by NoBrain: 05 August 2010 - 09:43 AM

Was This Post Helpful? 0
  • +
  • -

#8 Raz0r   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 7
  • Joined: 13-July 10

Re: Need help with File Declaring..

Posted 05 August 2010 - 10:09 AM

Thanks NoBrain, thanks telling that.

I want to ask you guys one more thing.

Does
System.AppDomain.CurrentDomain.BaseDirectory()


do the same thing?? Or is there any difference?? coz i find it to the same thing..just a doubt.

Thanks for all your help.
Was This Post Helpful? 0
  • +
  • -

#9 FlashM   User is offline

  • D.I.C Lover
  • member icon

Reputation: 383
  • View blog
  • Posts: 1,195
  • Joined: 03-December 09

Re: Need help with File Declaring..

Posted 05 August 2010 - 02:38 PM

System.AppDomain.CurrentDomain.BaseDirectory() returns you base directory for current application domain... But I would say that it possible that the application domain could be different then your application startup path...
Was This Post Helpful? 1
  • +
  • -

Page 1 of 1