|
first please download the PDFLibNet.dll from here: http://www.codeproject.com/KB/files/xpdf_csharp/PDFViewer.zip[^]
it's ok like this:
<br />
Assembly a = Assembly.LoadFile("PDFLibNet.dll");<br />
but exception like this:
byte[] b = File.ReadAllBytes("PDFLibNet.dll");<br />
Assembly a = Assembly.Load(b);<br />
throwing FileLoadException, telling me it could not verify the code or could not pass policy check. .net thinks that it is not a valid assembly.
I found a solution here: http://nonodes.spunow.co.uk/2009/04/assemblyload-c-cli-assembly-gives.html[^] telling me to build the C++ assembly with /clr:safe, but is there any other way out?
Regards,
unruledboy_at_gmail_dot_com
http://www.xnlab.com
modified on Tuesday, November 17, 2009 10:16 PM
|
|
|
|
|
I want to modify the AutoScrollMinSize of Form1 by the code as below:
private: System::Void button1_Click(System::Object^ sender, System::EventArgs^ e)
{
this->AutoScrollMinSize.Width=1000;
this->AutoScrollMinSize.Height=1000;
}
But it still not be active. Could somebody know how to modify the AutoScrollMinSize of Form1?
PS:already set Form1's AutoScroll as True.
modified on Tuesday, November 17, 2009 3:24 AM
|
|
|
|
|
a Size is a struct, hence a value type; you can't just modify part of it to modify the object. Assign a new Size with the width AND height you want.
Luc Pattyn [Forum Guidelines] [My Articles]
I only read code that is properly indented, and rendered in a non-proportional font; hint: use PRE tags in forum messages
|
|
|
|
|
Size is a struct, so when you directly modify its properties, you are actually modifying a copy of it. (Actually modifying two copies of it in your code, one for width and another for height ).
Use something like this:
this->AutoScrollMinSize = gcnew Size(1000,1000);
|
|
|
|
|
Could somebody know how to put any type controls on Toolstrip?
I want to put TrackBar and DomainUpDown controls to the Toolstrip.
|
|
|
|
|
System::Drawing::Bitmap ^pBitmap;
System::IntPtr intPtr = pBitmap->GetHbitmap();
//How to convert this IntPtr to HBITMAP
//HBITMAP hbitMap = intPtr
VIBIN
"Fool's run away,where angle's fear to tread"
|
|
|
|
|
Assuming HBITMAP's type is defined somewhere (it is a HANDLE,
which is a void*)
HBITMAP hbitMap = intPtr.ToPointer();
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
FolderBrowserDialog FolderBrowserDialog1;
//FolderBrowserDialog1.RootFolder=System::Environment::SpecialFolder::Startup;
|
|
|
|
|
Something like,
FolderBrowserDialog folderBrowser;
folderBrowser.SelectedPath = Application::StartupPath;
Best wishes,
Navaneeth
|
|
|
|
|
The application's current working directory can be obtained
with System::IO::Directory::GetCurrentDirectory().
The current working directory is not necessarily the same as
the startup path
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Thanks. I has solved this problem.
|
|
|
|
|
My CLR project have many Split Containers, one Container has a customed user control.
I want to Render a cylinder with DirectX9 on the user control.
Could somebody tell how to get windows handle of user control or render with DirectX?
|
|
|
|
|
reference: http://social.msdn.microsoft.com/Forums/en-US/vcgeneral/thread/71bfe0b7-7609-4c8b-b106-f901e8f379b1[^]
It depends on how your "customized user control" is implemented. However, it comes down to using the windows handle (HWND) and passing that to your DirectX device.
If you're using MFC, everything derives from CWnd. You'll want to use CWnd::m_hWnd.
If you're using Windows Forms with C++/CLI, everything will derive from Control, and you can use Control.Handle.
--------------------------------------------------------------------------------
Reed Copsey, Jr. - http://reedcopsey.com
|
|
|
|
|
That is my partial source code:
public ref class PreviewView : public System::Windows::Forms::UserControl
{
LPDIRECT3DDEVICE9 d3ddev;
private: void initD3D(HWND hHandle)
{
d3d = Direct3DCreate9(D3D_SDK_VERSION); // create the Direct3D interface
ZeroMemory(pd3dpp, sizeof(*pd3dpp)); // clear out the struct for use
pd3dpp->Windowed = true; // program windowed, not fullscreen
pd3dpp->SwapEffect = D3DSWAPEFFECT_DISCARD; // discard old frames
pd3dpp->hDeviceWindow = hHandle; // set the window to be used by Direct3D
LPDIRECT3DDEVICE9 d3ddevTmp;
// create a device class using this information and information from the d3dpp stuct
d3d->CreateDevice(D3DADAPTER_DEFAULT,
D3DDEVTYPE_HAL,
hHandle,
D3DCREATE_SOFTWARE_VERTEXPROCESSING,
pd3dpp,
&d3ddevTmp);
d3ddev=d3ddevTmp;
}
When I create device, I must use another variable d3ddevTmp to return the D3DDevice and then set to d3ddev member variable. If I use d3ddev to create device, it will appear the error message as below:
Error 1 error C2664: 'IDirect3D9::CreateDevice' : cannot convert parameter 6 from 'cli::interior_ptr<Type>' to 'IDirect3DDevice9 **' d:\svn\......\PreviewView.h 121
Could somebody tell me how to solve this problem?
|
|
|
|
|
You have to "pin" d3ddev which is currently controlled by the GC. That is, assign it to a pin_ptr<D3DDevice>.
Greetings - Jacek
|
|
|
|
|
Thanks. I has solved this problem.
|
|
|
|
|
I have developed an application(managed + unmanaged) in VC++ using Visual Studio 2005. It can switch to either Console or to windows form depending upon the no of parameters passed to the application on command prompt console. Its basically a windows application but console has been implemented with the help of Attachconsole(), allocconsole() & freeconsole().
Now if i run a batch file, using command prompt console, all the output messages of the application can be seen on the console as shown below.
c:\test> testapp -f filename -l operationname -t otherparams
filename selected..
operation in progress..
operation completed successfully!!
But if i redirect the output of the console to a text file, i dont see any messages in the text file once the operation is complete.
for eg:
c:\test> testapp -f filename -l operationname -t otherparams >> logfile.txt
Clarifications i need are
1. am i missing something to log it in a text file?
2. Can output messages from the console be logged in such a fashion. if yes, how?
Thanks in advance for help/suggestions on the same.
|
|
|
|
|
This looks correct to me. What happens when you type a simple command (e.g. dir ) instead of your application command line?
|
|
|
|
|
If i type in "Dir" command, normal dir contents are displayed.
you mean to say the console that is opened in my application is not a standard console to redirect the output/input using ">>" or ">"? If yes, then how do i redirect teh input & output to a file?
Thanks
|
|
|
|
|
santoshkaif wrote: you mean to say the console that is opened in my application is not a standard console to redirect the output/input using ">>" or ">"? If yes, then how do i redirect teh input & output to a file?
I'm not sure I understand what you are saying here. If you run an application in a command window then you should be able to redirect the output to a file. Are you saying that you are doing something different?
|
|
|
|
|
Hello,
I need some help with the following:
I created a form with textfields there are 2 buttons on the form to save or to cancel.
I also added a leave event on some text fields because I need a test to control if the field is filled in.
When I'm on a field that needs to be filled and I push the cancel button without putting some value in the field the leave event still is executed then I get the message that field has to be filled in!
How can I solve this? How can I test if the cancel button is pushed in the leave of that text field?
Thanks for the help!
|
|
|
|
|
why do you want to validate inputs on Control.Leave? just do it when the "Save" Button is pressed.
Luc Pattyn
I only read code that is properly indented, and rendered in a non-proportional font; hint: use PRE tags in forum messages
|
|
|
|
|
I thought of that too but the save button closes also the form (Form is called from another form with a datagridview on it. This form is the contents of a record). And If I push the save button, I get the message but I cannot put focus back into the textfield because of the form that's closing?
Any other suggestion?
modified on Thursday, November 5, 2009 8:18 AM
|
|
|
|
|
The "Save" Button will do what you tell it to do, most likely "validate, and if OK, then close".
Luc Pattyn
I only read code that is properly indented, and rendered in a non-proportional font; hint: use PRE tags in forum messages
|
|
|
|
|
You're right but if I do that how does the main program (calling program) knows that buttonOK is pushed?
form2 is made with UI!
Form^ form2 = gcnew Form;
form2->buttonSave->DialogResult = ::DialogResult::OK;
form2->buttonCancel->DialogResult = ::DialogResult::CANCEL;
form2->ShowDialog();
if ( form2->DialogResult == ::DialogResult::OK )
{
...
DataAdapter->Update(myDataSet, "DATA");
}
modified on Thursday, November 5, 2009 8:26 AM
|
|
|
|