I am using a class module in my project. I made an EXE of the project. But this EXE gives error when I run this on another PC... even in mine PC, if run from another folder.
I get following error - 5 - Invalid procedure call or argument.
Can somebody guide me how to use the Class module while making EXE..?
A class module is analogous to a form module or a standard module (which is called just "module") in VB6. Basically, anything that has its own code window is a module. Class modules are saved with a .cls extension.
The probable reason for your error is that you can't see the class at the point you're attempting to use it.
Your question could mean several different things. Please give me a list of all the projects (maybe you have just one, but you could have more), all the forms, all the standard modules (just called "modules"), and all the class modules you are using. That will help me understand better how to answer your question.
Related
this is my first time working with Ruby.
I am currently working with a program that includes a module in the start with "include MODULENAME".
My goal is to "rebuild" this programm to implement it in my own software.
My problem is I can't figure out where this module is coming from.
The program allows the entry of further commands (in Ruby). So my question is, are there any commands i can use to find where this module comes from?
I apreciate any kind of help.
Object.const_source_location(MODULENAME)
should tell your where MODULENAME is defined. See docs for const_source_location
I have been given source code by my boss which is written in Vb6, It runs on his machine but it gives an error on mine. The error is about declaration or I could be missing some reference.
this is the line:
Private WithEvents cP As cPopupMenu
the error is user-defined type not defined
Please advise.
Must be because you're missing the class cPopupMenu. Make sure that in your VB project the class cPopupMenu is availlable
As you said yourself, you are probably missing a reference. The project is probably referencing another activex .dll that hasn't been registered on your computer, and the cPopupMenu class resides there. Have you gone to Projects:References and looked for any references listed as Missing? They will show up there. You can also open the .vbp file in a text editor and look at the references, although going to Projects:References is generally faster and easier. Good luck!
I'm having staring issues with Module name spacing in a swift project.
I've tried this in a new project and everything works fine:
I have 2 modules with which contain the same class name and i'm able to reference the class from Module.Class no problem.
I have an existing swift project and I'm unable to get this working. I keep getting the error
So as you can see if I don't try to Module-Scope the class everything works fine.
(And yes i've tried with and with out the .Type addition).
So I'm assuming there is something off in my compiler setting. The only other thing I can think of is that my LocationMessage class is defined not in the main DataManager "class" file but rather in a different file.
But I really can't make heads or tails of whats going on. Any suggestions?
Project Structure
Framework: DataManager
DataManager.swift
LocationMessages.swift
Framework: ReferenceTest
File.swift
So my issue is that in File.swift I'm trying to reference a class defined in LocationMessages.swift inside the DataManager.framework The class IS public
#objc(DMLocationMessage)
final public class LocationMessage : ParsedMessage {
There is also this bug in swift compiler: SR-631 Extensions in different files do not recognize each other
The result (success/failure) of the compilation depends on the order of files in Build Phase > Compile Sources setting.
I had exactly the same error message: X is not a member type of Y. Solved it by rearranging compilation sources.
In case anyone is here while trying to build and use an xcframework, apparently, the issue is caused when you have a class in the framework which has the same name as the module/framework.
This is a known issue and needs a workaround as mentioned here.
P.S. - I know this doesn't answer this question per se. Just leaving it here for anyone else who might land here because of the question title.
If using xcframework follow below steps to get rid of error :
In terminal, go to the folder where .xcframework is located.
Run the following terminal command after replacing the frameworkName with your framework name:
find . -name "*.swiftinterface" -exec sed -i -e
's/frameworkName\.//g' {} \;
Replace the old xcframework in your project with xcframework generated with above command. Clean build the project.
The above error only occurs in xcframework when a class named is same as the module name. Details on Apple forum at: https://forums.developer.apple.com/thread/123253
You likely have a class/struct/enum DataManager anywhere in your code which hides the DataManager module. The error states that it cannot find LocationManager in type DataManager where it should read module instead.
Your app modules should be designed in a way so that you never need to explicitly use the module's name except for the import statement. So just use LocationMessage.Type directly without stating the module.
This is one reason all our app's modules are prefixed with an X, e.g. XDataManager. This avoids conflicts with Apple's modules, external modules (like from CocoaPods) and with types (like in your case).
The X also makes it obvious that these modules are part of the app itself and not some third-party frameworks.
When using an xcframework that depends on another framework, the X is not a member of type Y will also happen for the Framework it depends on when writing an extensions that wraps, for example, delegate methods
Example:
Framework Foo depends on Bar and need to conform to DataDelegate.
class Foo {
...
}
extension Foo : Bar.DataDelegate {
...
}
Everything during compiling will go as planned and the xcframework will be generated. Once you add it to your App along with the dependancy framework Bar and try to build it you will get DataDelegate is not a member of type Bar.
There is a workaround for this! 🎉
You should
Create a new empty swift file
Import just the type (not entire module) you need to use:
/* import MyModule */ // NOT THIS!
import enum MyModule.Theme // This will only import the `enum`. You can use this method for `class`, `structs` and others too.
Make a typealias for the imported type:
typealias MyUniqueName = MyModule.Theme
Use the new unique name that you just created.
This is the only workaround that compiler understand what do you mean exactly (without need to change the internal module names.
Result
Remember the final file will contain only two lines:
import enum MyModule.Theme
typealias MyUniqueName = MyModule.Theme
I created a VS 2010 class library. Marked the assembly for Com Visibility. Signed the assembly with a strong key. Created my class, have my entry point method available.
The library works fine from a test project in C#.
I regasm the class library to gac, via:
c:\windows\microsoft.net\framework\v4.0.30319\regasm testdll.dll /tlb: testdll.tlb /codebase
Include the tlb file as a reference in my VB6 project. I find it through resources 'browse' so its there.
When i try to instantiate the class... its empty. the public method that should be available via the public class doesn't show.
Dim objTest as testdll.testclass
set objTest = new testdll.testclass
objTest.testmethod <--- this 'testmethod' doesn't display in intellisense... nothing does.
In addition i tried calling the 'testdll.testclass' via CreateObject, i get the error "ActiveX component can't create object"
Now i have other projects i've done COM visibility for and i've tried comparing the difference, but i don't see any. I can't understand why it isn't working.
Any clues??? tx very much.
Just use an interface... one you define or to use the [ClassInterface(ClassInterfaceType.AutoDual)]
there are comments online you can find that indicate not to use autodual, but if you control the complete usage of your library, it seems like an 'ok' way to go.
I tried all sorts of ways to simulate / understand why my one project didn't need an interface to be visible by an vb project, without success. i had originally thought perhaps possible that it was because that project implemented an IDisposable Interface (the ONLY interface used in the C# projects that is com visible) but that didn't turn out to be the reason. Anyway I don't want to waste anyone else's time on this. thanks for the responses.
this link provides ample information on the subject:
http://anturcynhyrfus.blogspot.com/2011/03/creating-com-visible-c-component.html
I want to add my own project type based on IronStudio. So,
I downloaded the source for and compiled the latest version of IronPython, then
I created a new Visual Studio Package.
I added the Templates\Projects\MyProject folders, and added a file to it, and set its property "Include in VSIX" to true.
Then modified the main Package class to be derived from IronStudio's PythonProjectPackage instead, and set the ProvideProjectFactory property:
[ProvideProjectFactory(
typeof(PythonProjectFactory),
"Django Project",
"Django Project Files (*.myproj);*.myproj",
"myproj", "myproj",
#"Templates\Projects\MyProject",
LanguageVsTemplate="MyProject")]
public sealed class MyPackage : PythonProjectPackage
And ran it. But MyProject isn't showing up in the project templates. Why not?
The generated .pkgdef file looks like this:
[$RootKey$\InstalledProducts\VSPackage3Package]
#="#110"
"Package"="{5cd7435c-7461-459f-80bc-c0c79e9d462f}"
"PID"="1.0"
"ProductDetails"="#112"
"LogoID"="#400"
[$RootKey$\Packages\{5cd7435c-7461-459f-80bc-c0c79e9d462f}]
#="Microsoft.VSPackage3.VSPackage3Package, VSPackage3, Version=1.0.0.0, Culture=neutral, PublicKeyToken=a4f1577d825253f8"
"InprocServer32"="$WinDir$\SYSTEM32\MSCOREE.DLL"
"Class"="Microsoft.VSPackage3.VSPackage3Package"
"CodeBase"="$PackageFolder$\VSPackage3.dll"
[$RootKey$\Editors\{888888c4-36f9-4453-90aa-29fa4d2e5706}]
"Package"="{5cd7435c-7461-459f-80bc-c0c79e9d462f}"
[$RootKey$\Editors\{888888c4-36f9-4453-90aa-29fa4d2e5706}\Extensions]
"py"=dword:00000020
[$RootKey$\Editors\{888888c4-36f9-4453-90aa-29fa4d2e5706}\LogicalViews]
"{7651a701-06e5-11d1-8ebd-00a0c90f26ea}"=""
[$RootKey$\Editors\{888888c4-36f9-4453-90aa-29fa4d2e5706}\LogicalViews]
"{7651a702-06e5-11d1-8ebd-00a0c90f26ea}"=""
[$RootKey$\Editors\{888888c4-36f9-4453-90aa-29fa4d2e5706}\LogicalViews]
"{7651a703-06e5-11d1-8ebd-00a0c90f26ea}"=""
[$RootKey$\CLSID\{888888fd-3c4a-40da-aefb-5ac10f5e8b30}]
#="Microsoft.IronPythonTools.Project.PythonGeneralPropertyPage"
"InprocServer32"="$WinDir$\SYSTEM32\MSCOREE.DLL"
"Class"="Microsoft.IronPythonTools.Project.PythonGeneralPropertyPage"
"CodeBase"="$PackageFolder$\VSPackage3.dll"
"ThreadingModel"="Both"
[$RootKey$\Projects\{888888a0-9f3d-457c-b088-3a5042f75d52}]
#="PythonProjectFactory"
"DisplayName"="My Project"
"DisplayProjectFileExtensions"="My Project Files (*.myproj);*.myproj"
"Package"="{5cd7435c-7461-459f-80bc-c0c79e9d462f}"
"DefaultProjectExtension"="myproj"
"PossibleProjectExtensions"="myproj"
"ProjectTemplatesDir"="$PackageFolder$\Templates\Projects\MyProject"
"Language(VsTemplate)"="MyProject"
[$RootKey$\NewProjectTemplates\TemplateDirs\{5cd7435c-7461-459f-80bc-c0c79e9d462f}\/1]
#="My Project"
"SortPriority"=dword:00000064
"TemplatesDir"="$PackageFolder$\Templates\Projects\MyProject"
[$RootKey$\Projects\{888888a0-9f3d-457c-b088-3a5042f75d52}]
#="PythonProjectFactory"
"DisplayName"="IronPython"
"DisplayProjectFileExtensions"="IronPython Project Files (*.pyproj);*.pyproj"
"Package"="{5cd7435c-7461-459f-80bc-c0c79e9d462f}"
"DefaultProjectExtension"="pyproj"
"PossibleProjectExtensions"="pyproj"
"ProjectTemplatesDir"="$PackageFolder$\.\NullPath"
"Language(VsTemplate)"="IronPython"
[$RootKey$\NewProjectTemplates\TemplateDirs\{5cd7435c-7461-459f-80bc-c0c79e9d462f}\/1]
#="IronPython"
"SortPriority"=dword:00000064
"TemplatesDir"="$PackageFolder$\.\NullPath"
[$RootKey$\Services\{b98e41c4-581e-3532-beee-06829b683d39}]
#="{5cd7435c-7461-459f-80bc-c0c79e9d462f}"
"Name"="IPythonStarter"
I just want to get the bare bones up and running so I can start overriding some functionality (like the Add New Item dialog).
Update:
Reading my initial analysis once again increases my impression that some of the required components are missing (e.g. a dedicated ProjectFactory) and/or wired up incorrectly - from the MSDN documentation of the ProvideProjectFactoryAttribute Class:
ProvideProjectFactoryAttribute declares that a package provides a project factory.
And further:
If a VSPackage declares that it provides a project factory, it should create the factory and offer it to Visual Studio in the Initialize method of the Package-derived class.
You package is declaring to provide PythonProjectFactory, but (likely) doesn't offer it to VS, rather it is offered by the IronPython package. In turn you are providing arguments within the ProvideProjectFactory attribute list which PythonProjectFactory won't know about when asked for by VS.
Consequently you should at least provide a dedicated ProjectFactory yourself as per the walkthrough, wire up the classes accordingly and see how this turns out regarding the issues outlined below.
Initial analysis:
There appear to be several issues here at first sight - have you followed any tutorial on how to do this? In case, please note that some of those easily discoverable via search engines are outdated still. Either way I'd try working through and/or comparing your result with Walkthrough: Part 1 - Creating a Basic Project System from the MSDN documentation for VS 2010; please note that even this one is claimed to be outdated a bit according to the Community Content section on the bottom of the page.
Here is what I'd look into myself given the code you present, comparing with the walkthrough on the fly for more insights:
You realized already that the duplicate fragment starting with the GUID above PythonProjectFactory doesn't make sense - this is essentially trying to register two packages at once, which, even if allowed at all syntactically (which I doubt), can't possibly work like so due to both being registered with the same GUID [cross checking with the sample file in section Examining the Template Registration confirms this suspicion, as expected there is only one such fragment].
Please note that the GUID in question is the one identifying PythonProjectFactory (as per the respective source code), see below for more on this.
[Guid(PythonConstants.ProjectFactoryGuid)]
public class PythonProjectFactory : ProjectFactory {
Given .pkgdef is a generated file the next question is where this duplication/violation stems from. When two generated artifacts end up with the same GUID the respective definition in the sources is most likely messed up somehow, usually due to copy&paste duplication. Consequently you should verify whether {5cd7435c-7461-459f-80bc-c0c79e9d462f} is defined and referenced as intended, though here might be one or two other causes as well for this, see below.
A Package class needs to be identified by a GUID and the VS wizard generates some already in Guids.cs and references it accordingly on the class definition, however, the following is missing in your fragment [cross checking with the sample fragment in section To register the project template confirms this omission as well]:
[Guid(GuidList.guidMyPackagePkgString)]
public sealed class MyPackage : Package
Likewise it appears incorrect to derive MyPackage from PythonProjectPackage but reference PythonProjectFactory still rather than providing MyFactory as well (including a dedicated GUID), because the latter tells Visual Studio the location of your project template folder [see section Creating a Skeletal Project Factory]:
While it might well be possible to simply reuse all functionality from the base class PythonProjectFactory, inheriting is likely required simply because the factory must have a dedicated GUID too (as outlined in the walkthrough) in order to properly wire up the attribute specified data.
Likely unrelated, but still suspicious is that your two code blocks don't relate, as the Package class definition specifies Django Project Files (*.myproj);*.myproj, yet the result shows My Project Files (*.myproj);*.myproj.
Have you by chance mixed this from different builds or is this really a result of a clean one?
Good luck!
This stackoverflow posting might be helpful: VS2010: VSIX installation doesn't deploy item templates inside it
If this is not what you're looking for, try to see if you're missing something around the creation of custom project templates, I believe that's where the "missing link" is:
For VS 2008:
http://blogs.msdn.com/b/webdevelopertips/archive/2008/12/02/tip-32-did-you-know-how-to-easily-create-your-own-project-templates.aspx
For VS 2010:
http://blog.reybango.com/2010/09/21/how-to-create-html5-website-and-page-templates-for-visual-studio-2010/
and on MSDN:
http://msdn.microsoft.com/en-us/library/s365byhx.aspx
and here is how to create a project
template manually:
http://msdn.microsoft.com/en-us/library/ms185291.aspx
and here is how to create a new item template in VS 2010: http://msdn.microsoft.com/en-us/library/ms247113.aspx
Hope this helps
$PackageFolder$.\NullPath may have something to do with it.