Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
L

Le Sourcier

@Le Sourcier
About
Posts
10
Topics
7
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • IIS 6 to IIS 7 not working with unmanaged code
    L Le Sourcier

    I've got an IIS v6 (Windows Server 2003) web site which uses an old DLL written with unmanaged code. (Aspx, C# using System.Runtime.InteropService to call unmanaged dll) But I've bought a new Windows Server 2008 with IIS7 and the call to unmanaged DLL is not working. In fact my C# code call an unmanaged DLL but the code never ends. It's entering in DLL code (all is working until the "return"; instruction, but it does not return to C# !!). I've tried to configure the application pool (classic mode), the web site properties... but to hard for me.At a time I got the error "IIS Worker Thread stop working"! A sample: ASPX

    <%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>

    <html xmlns="http://www.w3.org/1999/xhtml">
    <head runat="server">
    <title></title>
    </head>
    <body>
    <form id="form1" runat="server">
    <div>
    <asp:Table runat="server">
    asp:TableRow
    asp:TableCell
    <asp:Button ID="Button1" runat="server" Text="Button" onclick="Button1_Click" />
    </asp:TableCell>
    </asp:TableRow>
    asp:TableRow
    asp:TableCell
    <asp:Literal ID="Literal1" runat="server"></asp:Literal>
    </asp:TableCell>
    </asp:TableRow>
    </asp:Table>
    </div>
    </form>
    </body>
    </html>

    CS

    using System;
    using System.Runtime.InteropServices;

    public partial class _Default : System.Web.UI.Page
    {
    [DllImport("MyDLL.dll", EntryPoint = "?get_html@@YAPBDN@Z")]
    static extern string get_html(double value);

    protected void Button1\_Click(object sender, EventArgs e)
    {
        Random a = new Random();
        Literal1.Text = get\_html(a.NextDouble());
    }
    

    }

    DLL C++

    #include "stdafx.h"
    #include "stdio.h"

    char myBuffer[MAX_PATH];

    __declspec(dllexport) const char * get_html(double value)
    {
    memset(myBuffer, 0x00, MAX_PATH);
    sprintf(myBuffer, "<html><title>Test</title></head><body>Entered value : %.2f<br>Value x2 = %.2f</body></html>", value, value*2);
    return myBuffer;
    }

    With IIS6, when the button is clicked the HTML text is displayed (all is good). With IIS7 nothing is happening !

    ASP.NET windows-admin csharp c++ html design

  • Processing client file before uploading it
    L Le Sourcier

    I think this is a difficult job. What I have to do in my asp.net (3.5) website: . The client select a file from his filesystem (actually a 512MB bin file from a dedicated SD card) . A client script extract useful data from bin file and compress it (to minimize the amount of uploaded data) . The file is uploaded to asp.net server . The file is processed by the server (to read bin file data and insert it into a database) So my real question : Is it possible to do this with asp.net/C# (or any other language) with a minimal user interaction? Actually I've make it works but with a java applet, and it's not very intuitive and efficient. The user had to select the bin file, save it to a temporary compressed file (done by applet). And finally the user selects a new time the previously saved compressed file and upload it (asp:upload)... So is it possible to do it with ASP.NET ? If yes (or I you have an idea) please just answer me. Thanks for any answer. BR

    Le Sourcier

    ASP.NET csharp question java asp-net database

  • ASP.NET server that call unmanaged DLL
    L Le Sourcier

    Hi, The ASP.NET engine seems to have problems with calling unmanaged DLL. You can call unmanaged DLL with Interopservces with such a code [DllImport("ImportCoreASPNET.DLL", EntryPoint = "?import_4aspnet_start_it@@YAHPBD@Z")] static extern int import_4aspnet_start_it(string filename); there are two requisites: 1. place the dll in a directory included in PATH (environment variable) 2. make sure that the dll does not call other DLL. (I had problem with one dll calling 3 others, and dll or entrypoints are never found) So I had to merge my dlls in unique one to make it works with ASP.NET. Regards,

    Le Sourcier

    ASP.NET csharp c++ help asp-net winforms

  • ASP.NET server that call unmanaged DLL
    L Le Sourcier

    Hello, I have a critical problem :mad: with my ASP.NET server :~. In fact, I want my ASP.NET code behind (C#) to call a DLL (C++, unmanaged and without COM). I tried to use [DLLImport("MyDLL.DLL")] public extern static void instanciate_unmanaged_process(); Unfortunately, each time I call instanciate_unmanaged_process(); a new System.DLLNotFoundException is thrown. I have tried to put my DLL in many directories (current, system32, asp.net bin) and it does not work. Then I tried to write the full path in DLLImport("c:\\projects\\bin\\MyDLL.DLL"), but the same exception appears. :sigh: :sigh: :sigh: :sigh: :sigh: :sigh: I have tried to make a managed dll wrapper, but it does not work anymore. (same exception) :omg: I tried the old LoadLibrary/GetProcAdress way, and GetProcAdress is still returning null. :wtf: It works fine through a Winforms application but not through asp.net.:confused: Someone could help me ? Using: VS2008 Pro Framework 3.5 (almost 2.0 for ASP.NET server) Web server with IIS 6.0 (win xp) Unmanaged DLL compiled with Visual C++ 6 Thanks a lot.

    Le Sourcier

    ASP.NET csharp c++ help asp-net winforms

  • XML database ?
    L Le Sourcier

    I want to create an light weight XML database, but I don't find anything which could interest me. It is to make a very small DB, in XML format (so it could be modified with any text editor). I want to completely integrates database API in my executable (I don't want to use software like MySQL or PostgreSQL, because it must be on any computer with no installation required). So my executable must integrates database API and store data into XML file format. I've an idea about using SQLite and any XML parser like Pugxml but I would like to find something like SQLite with storing data directly in XML. does anyone knows something about doing this ? I work on Visual C++ 6.0 Sp6 (MFC/ATL). thanks for all :wtf:

    Le Sourcier

    My Foo website

    XML / XSL c++ database xml mysql postgresql

  • PostgreSQL, ODBC and transaction strange behavior
    L Le Sourcier

    I've a serious problem :(( in my software while inserting data in PostgreSQL tables. I'm using VC6.0 sp6, the last PostgresSQL release and the last associated psqlODBC driver. I can not find anything in msdn help, so I post my problem and I except that someone could help me.:rolleyes: That is the way I insert my data: 1. I create a database connection to my database, using psqlODBC driver 2. I open a recordset (with appendOnly and bulkrowadd options) 3. Start a transaction with CDatabase::BeginTrans() 3. I insert lots new records to my table (hundreds of records) 4. Commit transaction with CDatabase::CommitTrans(); 5. Close database connection But, when an insert fails (a CDBExcpetion is thrown in Update() function), then all previously non commited records are lost !!!:~ I just want only bad insert to be lost but not all my records updated since BeginTrans() Here is my code : CDatabase * pDatabase = new CDatabase(); pDatabase->OpenEx(); //ask user to select a DSN CRecordsetST myRecordset(pDatabase); myRecordset.Open(AFX_DB_USE_DEFAULT_TYPE, NULL, CRecordset::optimizeBulkAdd | CRecordset::appendOnly); if(!myRecordset.IsOpen()) { pDatabase->Close(); return; } pDatabase->BeginTrans(); while( //file is not EOF ) { try { myRecordset.AddNew(); //fill recordset fields with file data //..... //..... //..... //..... myRecordset.Update(); } catch(CDBException *e) { //if a CDBException is catched, then //cancelupdate to pass current record //and continue to next data without //doing rollback //cancel update to prepare next record myRecordset.CancelUpdate(); //trace some message OutputDebugString(e->m_strError+_T("\n")); e->Delete(); //here I do not want to rollback my transaction, but just cancel current update //and continue my process with keeping all previously added records (good ones) } catch(...) { //if an unknown exception if catched then rollback all myRecordset.CancelUpdate(); //trace some message OutputDebugString(_T("FATAL error while inserting data\n")); //perform rollback pDatabase->Rollback(); pDatabase->Close(); return; } //read next line in file } pDatabase->CommitTrans(); pDatabase->Close(); ... I've tried to commit current transaction in first catch, but records are not saved. I've searched for some options in CDatabase or CRecordset, but I didn't find anything. I excepect that you could help me. thanks for all.

    Database help announcement database postgresql debugging

  • Synchronize time
    L Le Sourcier

    thanks, with the msdos command "net time /SET /YES \\my_server" you can synvhronise computer system time with the server one Tchao Firejano

    C / C++ / MFC csharp c++ sysadmin question

  • Synchronize time
    L Le Sourcier

    I try to synchronise my computer system time, with server one. Firejano

    C / C++ / MFC csharp c++ sysadmin question

  • Synchronize time
    L Le Sourcier

    My program needs to be synchronised with my data server. I must do it into my program, in VC++ 6 (not in .NET). I can not find any function in msdn which do it. :(( I've another solution,;) instead of synchronising, I need to get the system time of the server. But I can not found any function to do this.:sigh: Does someone has already realize it ? Firejano

    C / C++ / MFC csharp c++ sysadmin question

  • What's this?
    L Le Sourcier

    I've created an application with runs as a plugin for Microstation. My application is a DLL whose functions are called by Microstation in a specific lanaguage. if my function launch a dialog box like this definition: extern "C" __declspec(dllexport) BOOL fooSystem_showAboutBox(); implementation: BOOL fooSystem_showAboutBox() { AFX_MANAGE_STATE(AfxGetStaticModuleState()); try { theApp.showAboutBox(); } catch(...) { return FALSE; } return TRUE; } //in foo.cpp void CFooApp::showAboutBox() { CAboutDialog dlgAbout; dlgAbout.DoModal(); } then, the "about" dialog is not able to intercept any messages like WM_TIMER, and the function PreTranslateMessage is never reached. This problem is also valid for theApp. There isn't any other classes which may intercept messages before my function (maybe except one from MFC hierarchy) or implementing the virtual function PreTranslateMessage. I really don't understand this. Have you any idea about this issue ? Thanks. Firejano -- modified at 11:42 Thursday 27th October, 2005

    C / C++ / MFC c++ help question
  • Login

  • Don't have an account? Register

  • Login or register to search.
  • First post
    Last post
0
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups