第一个窗口程序:无法看到输出

时间:2015-05-03 16:59:14

标签: visual-c++

嗯,这可能听起来很愚蠢,但我已经制作了第一个Windows程序:

#include<windows.h>
int_stdcall WinMain (HINSTANCE hInstance, 
                     HINSTANCE hPrevInstance,               
                     LPSTR IpszCmdline,                 
                     int nCmdShow) 
{
    MessageBox(0, "Hello!", "Title", MB_OK); 
    return 0; 
}

当我运行它时,它运行但输出窗口不显示。我的意思是我没有看到任何关于&#34; Title&#34;在标题栏和&#34;你好&#34;好的解决方案是什么?

1 个答案:

答案 0 :(得分:0)

您应该替换

int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
LPSTR lpszCmdLine, int iCmdShow)

使用以下代码:

MessageBox(NULL, TEXT("Hello!"), TEXT("Title"), MB_OK);

因为“int_stdcall”不正确。

此外,在MessageBox函数中,您应该编写

// MARK: - Map Annotations
func mapView(mapView: MKMapView!, viewForAnnotation annotation: MKAnnotation!) -> MKAnnotationView! {

    if annotation is MKUserLocation{
        return nil
    }

    let reuseId = "pin"
    var pinView = mapView.dequeueReusableAnnotationViewWithIdentifier(reuseId) as? MKPinAnnotationView

    if(pinView == nil){
        if let customAnnot = annotation as? myAnnotation {
            pinView = MKPinAnnotationView(annotation: customAnnot, reuseIdentifier: reuseId)


            pinView!.image = UIImage(named:"pin-50.png")


            pinView!.animatesDrop = false
            pinView!.draggable = true
        }

    } else {
        pinView!.annotation = annotation as? myAnnotation
    }

    return pinView!
}
相关问题