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
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. "#USING " in vc++6 ??

"#USING " in vc++6 ??

Scheduled Pinned Locked Moved C / C++ / MFC
csharpc++helpquestionannouncement
6 Posts 4 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • F Offline
    F Offline
    fx9200
    wrote on last edited by
    #1

    HELLO I copied a code from the microsoft documentation in order to list loca eventlogs but it seems to be writed for .NET version. but it dosen't work also in .net studio can Someone help me? #using #using using namespace System; using namespace System::Diagnostics; using namespace System::Threading; int main() { // TODO: Place code here. EventLog* localEventLogs[]; localEventLogs = EventLog::GetEventLogs(); Console::WriteLine(S"Number of logs on local computer: {0}", __box(localEventLogs->Length)); System::Collections::IEnumerator* myEnum = localEventLogs->GetEnumerator(); while (myEnum->MoveNext()) { EventLog* log = __try_cast(myEnum->Current); Console::WriteLine(S"Log: {0}", log->Log); } return 0; }

    C D M 3 Replies Last reply
    0
    • F fx9200

      HELLO I copied a code from the microsoft documentation in order to list loca eventlogs but it seems to be writed for .NET version. but it dosen't work also in .net studio can Someone help me? #using #using using namespace System; using namespace System::Diagnostics; using namespace System::Threading; int main() { // TODO: Place code here. EventLog* localEventLogs[]; localEventLogs = EventLog::GetEventLogs(); Console::WriteLine(S"Number of logs on local computer: {0}", __box(localEventLogs->Length)); System::Collections::IEnumerator* myEnum = localEventLogs->GetEnumerator(); while (myEnum->MoveNext()) { EventLog* log = __try_cast(myEnum->Current); Console::WriteLine(S"Log: {0}", log->Log); } return 0; }

      C Offline
      C Offline
      Christian Graus
      wrote on last edited by
      #2

      yep, that's managed C++. That'll work in VC2005 Express Edition ( which is free ), but it's never going to work in VC6. What version of VC do you have ? MAnaged syntax changed significantly between VS2003 and VS2005. This looks like VS2005 syntax to me, but I'm not sure.

      Christian Graus - Microsoft MVP - C++ Metal Musings - Rex and my new metal blog

      F 1 Reply Last reply
      0
      • C Christian Graus

        yep, that's managed C++. That'll work in VC2005 Express Edition ( which is free ), but it's never going to work in VC6. What version of VC do you have ? MAnaged syntax changed significantly between VS2003 and VS2005. This looks like VS2005 syntax to me, but I'm not sure.

        Christian Graus - Microsoft MVP - C++ Metal Musings - Rex and my new metal blog

        F Offline
        F Offline
        fx9200
        wrote on last edited by
        #3

        I have both VC++ 2005 and VC++6 but it didn't work in any of them

        C 1 Reply Last reply
        0
        • F fx9200

          I have both VC++ 2005 and VC++6 but it didn't work in any of them

          C Offline
          C Offline
          Christian Graus
          wrote on last edited by
          #4

          OK, well, it CAN'T work in VC6. In VC2005, you need to provide a little more information if you want people to be able to help you. What did it do ? What version are you using ? What's the code look like ( it looks to me like your original snippet is missing some stuff ).

          Christian Graus - Microsoft MVP - C++ Metal Musings - Rex and my new metal blog

          1 Reply Last reply
          0
          • F fx9200

            HELLO I copied a code from the microsoft documentation in order to list loca eventlogs but it seems to be writed for .NET version. but it dosen't work also in .net studio can Someone help me? #using #using using namespace System; using namespace System::Diagnostics; using namespace System::Threading; int main() { // TODO: Place code here. EventLog* localEventLogs[]; localEventLogs = EventLog::GetEventLogs(); Console::WriteLine(S"Number of logs on local computer: {0}", __box(localEventLogs->Length)); System::Collections::IEnumerator* myEnum = localEventLogs->GetEnumerator(); while (myEnum->MoveNext()) { EventLog* log = __try_cast(myEnum->Current); Console::WriteLine(S"Log: {0}", log->Log); } return 0; }

            D Offline
            D Offline
            David Crow
            wrote on last edited by
            #5

            fx9200 wrote:

            ...it dosen't work also in .net studio

            Why not? What's the problem? Copying code and then saying it doesn't work is not very helpful.


            "Money talks. When my money starts to talk, I get a bill to shut it up." - Frank

            "Judge not by the eye but by the heart." - Native American Proverb

            1 Reply Last reply
            0
            • F fx9200

              HELLO I copied a code from the microsoft documentation in order to list loca eventlogs but it seems to be writed for .NET version. but it dosen't work also in .net studio can Someone help me? #using #using using namespace System; using namespace System::Diagnostics; using namespace System::Threading; int main() { // TODO: Place code here. EventLog* localEventLogs[]; localEventLogs = EventLog::GetEventLogs(); Console::WriteLine(S"Number of logs on local computer: {0}", __box(localEventLogs->Length)); System::Collections::IEnumerator* myEnum = localEventLogs->GetEnumerator(); while (myEnum->MoveNext()) { EventLog* log = __try_cast(myEnum->Current); Console::WriteLine(S"Log: {0}", log->Log); } return 0; }

              M Offline
              M Offline
              Mike Dimmick
              wrote on last edited by
              #6

              That's Managed C++ syntax, not C++/CLI. It'll work directly in VS2003, but for 2005, you'll need to use the /clr:oldSyntax switch.

              Stability. What an interesting concept. -- Chris Maunder

              1 Reply Last reply
              0
              Reply
              • Reply as topic
              Log in to reply
              • Oldest to Newest
              • Newest to Oldest
              • Most Votes


              • Login

              • Don't have an account? Register

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