I created a costumer's database program. I have a problem in which I create a data module in a DLL and I compile it but then get some error below.
My concept is
The data module created in DLL and I insert ADO components in the data module.
This data module is used in another form. I created a db grid in the form but it doesn't
show the records in db grid. I compile it but get an error below.
I very thanks to solve my problem...
My English is not good but you try to understand........
TDataModule is just like a form but it's purpose is to be sort of a container form and is invisible to the end user. Although you can create a TDataModule in a DLL, it is not meant to be like that. TDataModules are there for the sake of simplifying your interaction with the whole app. Not to complicate it!!
IMHO, Don't create DataModules in a dll.
From your description, I think that you want a central datastore-like-module that is separate from the app that interacts with the user. May be there are more than one user. If that is the case try client-server approach.
The main difference between dll usage and packages is the shared memory model.
You can simply put a dbconnection in a package. a datamodule in another one. and the best of all is you can load & unload them at your convenience. Then you have access to this elements by unit usage.
As far as I know, there isn't any way for a GUI app to use dataset components in a DLL directly.
You might have better lock using packages, which are more Delphi object friendly. I haven't tried this, so I can't give much advice.
Or you could have your DLL pass back the dataset, which you put into a TClientDataset in you GUI application.
Related
TL;DR: I'd like to have a tool that receives an RESTful schema as input and provides a pyqt dialog/UI as output. Preferably with automatic submission/validation.
I'm working on a PyQt5 application that interacts with a remote Django server using django-rest-framework.
I find that I define most of my models/views/serializers quite quickly as they neatly extend one another. After writing a proper model, generating serializer and view is very easy and I end up with fully functioning server-side fast.
The client/GUI side is a different matter. I have to define the available fields again, their type and order. I have to define widgets for viewing a single object and a list of objects. I have to define edit interfaces and handle permissions.
This all seems like it could use some sort of automation.
Ideally, I could point a smart widget or form to a REST endpoint, and it'll automatically fetch the schema and allowed actions. Automatically create a GUI and the necessary error handling.
Ideally, this shouldn't depend on server side technology, and simply use a schema.
I've googled and couldn't find anything like that. Can someone point me at something similar? Is there a deeper issue with creating such a tool I'm missing?
Thanks!
Currently we have an application (a diagram editor), that have the ability to save and load (serialize) its state in a xml file.
Now we want this application to behave like Microsoft OneNote application. Where multiple users have the ability to access the same file.
Later we may also need to enhance with other things like, (1)what is changed and who changed it, (2)option to resolve conflicts if any.
I came to know about sync framework to resolve this. so far, i have not tried it.
All i want is,
Virtually single file should be edited by multiple instances of
same application.
We need a dll (sync framework) that does following
It takes complete responsibility of file handling.
Using this dll, each instance of the application will notify their own changes.
Each instance of the application should have the ability to detect the changes that is recently made (when, who, what are the changes).
My question:
Will sync framework be suitable for this requirement?
If so, is there a demo application that represents this?
No, Sync Fx cannot handle this. There's a file sync provider, but that's not smart enough to determine what has changed in terms of the actual contents of the file.
This is my first substantial MFC application.
My out-of-the-wizard MFC app wants to open a blank, new file of the type I specified for my app, when it starts, but that's not meaningful for my application. I want my app to open some connections to some remote sites and get data from them.
Where should I consider interrupting or overriding MFC's default behavior? I could subclass CWinApp::ProcessShellCommand(). I could modify the CCommandLineInfo object it works on. I could excise the whole command line processing and just call my go-get-the-data functions. I probably should just altogether excise the whole document-as-a-file related processing. I'm not opening or saving any files, except debug files or logs that are outside of the UI's concern. The only saving or collecting of local information is via a database, to which and from which I handle the serialization myself, so no CArchive, either.
I've got all this code but it's hanging in front of me disjointed and disintegrated. I'm too new to this and there's too many alternatives. Some simple guidance for a simple beginner is what I'm asking for.
So, if you'll say, sure, lop off the document-as-file handling, tell me, please, where I need to go to do that bit of surgery, I can see it's not just one object that'd be affected. And so forth. Thanks.
You might consider generating a new application, but when you do, tell it that you want a database application without file handling. Even if you don't use its database capability, it'll produce an application whose basic layout is set up roughly for what you're trying to do, so you'll basically just substitute your database interface for what it provides, but won't get involved with trying to rip out file handling and such that's apparently irrelevant for your program.
I found an answer with respect to modifying default file opening. While I made the database app Coffin suggested, I saw the phrase "storing database objects in views" and I rather aimlessly searched MSDN with that. If I was going to try the database app approach and do my own serialization, I had to learn about this.
I thus found an MSDN page concerning handling the file menu in database apps, which discusses how to alter and even disable the OnFileOpen command. It's applicable to OnFile New and it is the approach I was hoping for.
We are developing applications for use within AutoCAD.
Basically we create a Class Library Project, and load the .dll in AutoCAD with a command (NETLOAD).
As so, we can use commands, "palettes", user controls, forms etc...
AutoDesk provides an API through some dll's, running in their program directory.
When referencing these dll's you can only call the dll's at runtime while loading your app in AutoCAD (This is a licensing security from AutoDesk).
For us, while developing, this is not a problem, we need to visually test within the context of AutoCAD, so we just set the Debug Properties so that they start acad.exe and load our dll with a script in the acad.exe parameters.
The problem is, when trying to unit test our code, NUnit or mstest are not running from within the AutoCAD context and they also cannot start it.
There exist a tool called Gallio, which has provided an interface with AutoCAD, so that it can run Unit test through IPC with Named Pipes.
However, this solution is, for me, too much of a hassle. I want to be able to quickly write tests without having to leave my beloved IDE.
So, what, from a "good design view" would be a good approach to this problem? I'm thinking I would basically need a testable codebase which is not referencing the AutoCAD dll's and a non-testable that does references the untestable AutoCAD dll's.
I'm sure there are ways to get this to work: ( IOC, DI, Adapter Pattern,. .) I just don't these principles in depth and thus I don't know which route will best suit my purposes and goals.
The first step is to triage your code for parts which need AutoCAD and parts which are really independent. Create unit tests for the independent parts as you usually would.
For the other parts, you need mockups which behave like AutoCAD. Make them as simple as possible (for example, just return the correct answers in the methods without doing any calculations). Now, you need several sets of classes:
A set of interfaces which your code uses to achieve something (for example, load a drawing).
A set of implementations for said set of interfaces which call the AutoCAD dlls.
A set of classes which try the implementations within the context of AutoCAD. Just create a small UI with a couple of buttons where you can run this code. It is used to reassure yourself that your mockups do the right thing. Log method parameters and results to some file so you can try how AutoCAD responds. If a mockup breaks, you can use this code to verify what AutoCAD is doing and you can use it as a reference when developing the mockups.
When you know how AutoCAD responds, create the mockups. In your tests, create them with the desired results (and errors, so you can test error handling, too). So when you have boolean loadDrawing(File filename), create a mockup which returns true for the filename exists.dxf and false for anything else.
Use a factory or DI to tell your application code which implementation to use. I tend to have a big global config class with a lot of public fields where I simply store the objects to use. I can set this up in the beginning, it's fast, it's easy to understand. If you need to create objects at runtime, then put factories in the config class which generate the objects for you, so you can swap them out.
I wrote ... and later broke ... a Test runner for AutoCAD. It is at https://github.com/CADbloke/CADtest. If you're interested in it nudge me along and I'll fix it faster. I am waiting for NUnit v3 release before I tackle it.
If you reset to the 3rd commit in that repo (I think) and fiddle with it from there it should run.
We may start converting an old VS2003 MFC project to use the fancy new features provided by the MFC Feature Pack and VS2008. Several of the new UI controls would be very nice except for one thing - they automatically save their information to the registry. I don't have a problem with the registry, but for the multiple environments the users use out program from, it's much easier to save user data to the database.
So, I'm hoping that there is one main "access the registry" function that could be overloaded to point the database. But brief investigation hasn't turned up anything. Has anyone else had any success doing something similar?
It seems like it should be possible to do what you're suggesting, according to the information on this page in MSDN. I haven't tried this myself, so I don't know how difficult it will be in practice.
According to the documentation, you should create a class that inherits CSettingsStore to read and write the settings, and call CSettingsStoreSP::SetRuntimeClass so that the framework uses your class instead of the default.
The MFC feature pack uses code supplied by BCGSoft and they added this feature (so you can save state to an XML file, database, etc.) way back in 2001. I don't have the feature pack on this PC but try looking for a class called something like CMFCRegistrySP.
I will check myself tomorrow.
Does the StateCollection sample do this?
http://msdn.microsoft.com/en-us/library/bb983406.aspx