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
N

nfactorial

@nfactorial
About
Posts
9
Topics
1
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • Console app - how to "keep alive" ?
    N nfactorial

    If you need to do some processing inside the loop, call Sleep( 1 ) at the end of each loop. That should prevent starving windows of cpu time. n!

    C / C++ / MFC help question c++ performance tutorial

  • Convert CString to UINT
    N nfactorial

    What does 'ModifierKey' contain? It does contain and begin with an integer doesn't it? Otherwise atoi will return 0. n!

    C / C++ / MFC tutorial question

  • How to return NULL when return type is user defined
    N nfactorial

    All objects in Java are reference types, you're not returning by reference you're returning by value here. C++'s class model is different to Java, the closest built in primitive to a Java reference (which may be null, as you said) is a pointer (C++ references may not legally be null), which you said you'd like to avoid. The alternatives I can think of at the moment are: Throw an exception, of course, but that's a bit heavy handed for a failed search :) Return an integer index (with -1 meaning not found) and provide an index operator. Write a RefResult templated wrapper and return one of those, but that doesn't give you anything more than you'd get returning a pointer (except more code). My previous suggestion (returning bool). I can only say that C++ isn't Java and if you prefer the Java style then use Java? :) n!

    C / C++ / MFC help question tutorial

  • How to return NULL when return type is user defined
    N nfactorial

    Ahh ok, then I'd pass in a reference to be filled in and return a bool. bool Box::FindPoint( int x, Point &result ) const { for ( int i = 0; i < 40; ++i ) { if ( points[i].GetX() == x ) { result = points[i]; return true; } } return false; } n!

    C / C++ / MFC help question tutorial

  • How to return NULL when return type is user defined
    N nfactorial

    Why are you returning a 'Point' anyway? :) If it's found, they've already supplied the point in the first place, so the return result doesn't give them anything new except another point that matches the one they supplied. Maybe a 'bool HasPoint( Point point )' method may suit your needs, or you could return an integer index into the array (and -1 if it doesn't exist)? If you really do want to return a point for some reason then how about: class Box { private: Point points[40]; public: bool FindPoint( Point search, Point &result ); }; n!

    C / C++ / MFC help question tutorial

  • Auto-Hide Views
    N nfactorial

    There's a Win32 API function called AnimateWindow() which provides this type of effect. n!

    C / C++ / MFC csharp visual-studio sysadmin help tutorial

  • how to view property of a file in terms of coding
    N nfactorial

    Do you need to be notified when it's modified, or do you just want to store the modified time at one point and compare it again later? If you just want to store and compare then does the System.IO.FileInfo class do what you'd like? using System; using System.IO; FileInfo info = new FileInfo( "myfilename" ); DateTime modified = info.LastWriteTime; n!

    C# help tutorial question

  • FourCC's
    N nfactorial

    damn, so near and yet so far :) Thanks, n!

    C# csharp question announcement

  • FourCC's
    N nfactorial

    Does anyone have a FourCC class wrapper available? I'm new to C# so I'm not sure if I'm doing something wrong. I'd basically like to have a number of predefined types that I can use within my class, I've currently tried the following: namespace MyNamespace { public class MyClass { private static const FourCC TEST_FOURCC( 'T', 'E', 'S', 'T' ); } } Where 'FourCC' is a struct I've defined which accepts four values. The compiler moans at this though (cannot specify constructor arguments in declaration). As I'm new to C# is there something I've missed? It'd be great if I could just define them as an enum or uints (I've tried "private static uint TEST_FOURCC = 'TEST';" but it moans about too many characters in literal), I've also tried looking for a standard version in the framework but no luck. Thanks, n!

    C# csharp question announcement
  • Login

  • Don't have an account? Register

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